1、find检测str是否包含在mystr,如果是返回开始的索引值,否则返回-1
>>> mystr = 'hello world cd and hahacddaxigua'
>>> mystr.find('world')
>>> 6
>>> mystr.find('hh')
>>> -1
2、index和find一样返回索引值,单若str不在mystr中会报错
>>> mystr.index('cd')
>>> 12
>>> mystr.index('hh')
------------------------------------------------------
mystr.index('hh')
ValueError: substring not found
3、rfind、rindex从右往左找
>>> mystr.rfind('cd')
>>> 23
>>> mystr.rindex('cd')
>>> 23
4、count返回str在start和end之间,在mystr里出现的次数
>>> mystr.count('cd')
>>> 2
5、replace(str1,str2[,count])把mystr中的str1替换成str2,如果count指定,则从左至右替换不超过count次
>>> mystr
>>> 'hello world cd and hahacddaxigua'
>>> mystr.replace('world','World')
>>> 'hello World