查找
title_str=" This is a sentence. This is other sentence "
print(title_str.find('This',10,20))
print(title_str.find('This'))
join拼接
dirs='','usr','local','bin'
print('/'.join(dirs))
小写字母
name='Grubby'
names= ['grubby','green','lucy']
if name.lower() in names:
print('found it!')
替换
print('this is a test'.replace('is','rep'))
切分
print('/usr/local/bin'.split('/'))
去除空格
print(' with whitespace '.strip())
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。