常用的字符串操作
a = 'my name is Toni'
1、首字母大写
>>> print (a.capitalize())
My name is toni
2、打印50个字符,不够的用-代替,a变量内容在中间
>>> print (a.center(50,'-'))
-----------------my name is Toni------------------
3.匹配以什么结尾的。
>>> print (a.endswith('ni'))
True
4.设置tab的长度
>>> a = 'my name is Toni'
>>> print (a)
my name is Toni
>>> print (a.expandtabs(tabsize=30))
my name is Toni