1、首先在PyCharm软件中,打开一个Python项目。
2、在Python项目中,新建并打开一个空白的python文件(比如:test.py)。
3、使用 def 关键字定义一个 check(string, sub_str) 函数,进行判断。
4、插入语句:“string = "hello AA world"”,点击Enter键。
5、插入语句:“sub_str ="AA"”,点击Enter键。
6、插入语句:“check(string, sub_str)”,点击Enter键。
7、在编辑区域点击鼠标右键,在弹出菜单中选择“运行”选项。
8、程序运行完毕后,可以看到已经成功地判断字符串是否存在子字符串。