字符串常见处理

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)
posted @ 2018-09-27 18:29  exchange<>  阅读(74)  评论(0编辑  收藏  举报