查找
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())
网友评论