```python
# 查找方法 有两个。一是:find()函数,如果查找不到则返回 -1。二是:index()函数,如果查找不到,则报错
# 返回的值是:所查找的字符串的第一个字符的下标,下标从0开始
# 1: find函数语法:变量.find('所查找的字符串')
str_find = 'hello world and python and zxy'
print(str_find.find('and')) # 返回值: 12
# 1.1 rfind函数用法,从右侧开始查找,从整个字符串中查找到所需要的字符串的最右边的位置,但是显示的下标还是从左边0起始位置开始计数的,rindex函数同理
str_find = 'hello world and python and zxy'
print(str_find.rfind('and')) # 返回值: 23
# 2:find()函数,如果查找不到则返回 -1
str_find = 'hello world and python and zxy'
print(str_find.find('worlds')) # 返回值: -1
# 3:index()函数,变量.index('所查找的字符串')
str_index = 'hello world and python and zxy'
print(str_index.index('o'))
# 4:index()函数,如果查询不到则程序报错
str_index = 'hello world and python and zxy'
# print(str_index.index('o0'))
# 5:count()函数,返回所查找的字符串在整个字符串中出现的次数
str_count = 'hello world and python and zxy'
print(str_count.count('o'))