字符串常见处理

mystr = 'hello world itcast and itcastcpp'
s = mystr.find('hello')
print(s)
ind = mystr.index('world')
print(ind)
cou = mystr.count('c')
print(cou)
rep = mystr.replace('c','==')
print(rep)
spl = mystr.split(' ')
print(spl)
原文地址:https://www.cnblogs.com/zxt-cn/p/9714841.html