码迷,mamicode.com
首页 > 编程语言 > 详细

python(1):string/list/dict/file

时间:2017-12-29 16:20:34      阅读:102      评论:0      收藏:0      [点我收藏+]

标签:you   int   dict   ace   with   str   gpo   ++   log   

#string 操作要点
a=‘thankyou‘
print a.capitalize()
print a.center(20)
print a.endswith(‘s‘)
print a.startswith(‘t‘)
print a.find(‘o‘)
print a.center(20,‘\‘‘)
print a.rjust(20,‘+‘)

‘oo‘.join(a)
print a
print a.split(‘k‘)
print a.strip()
print a.strip(‘yu‘)
print a.replace(‘o‘,‘ww‘)

ans:

Thankyou
      thankyou     
False
True
6
‘‘‘‘‘‘thankyou‘‘‘‘‘‘
++++++++++++thankyou
thankyou
[‘than‘, ‘you‘]
thankyou
thankyo
thankywwu

 

python(1):string/list/dict/file

标签:you   int   dict   ace   with   str   gpo   ++   log   

原文地址:https://www.cnblogs.com/xuying-fall/p/8144876.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!