str()方法 分类: python 20130314 15:48 188人阅读 评论(0) 收藏

1. capitalize()

返回首字母大写格式的字符串

 


 2. center(width【,fillchar 】 )

    如果len(string)>width,则只会显示string。

            



s1='hello'
print s1.find('l') #返回索引

print s1.replace('k','m'),s1 #如果要替换的字符串不存在,则不进行其他操作


版权声明:本文为博主原创文章,未经博主允许不得转载。

原文地址:https://www.cnblogs.com/think1988/p/4628229.html