字符串常见处理
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)
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
總結
- 上一篇: ansible的参数及常用模块
- 下一篇: git 命令 clone分支的代码