字符串常見處理

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)
相關文章
相關標籤/搜索