title(),capitalize(),lower(),upper()
字符串的首字母大写,title只能用到字符串上面 capitalize() 整段文的第一个字符大写 upper() 所有的字母大写 lower()所有的字母小写
In [11]:
a=['tre','ert','dfr','dfg']
[name.title() for name in a]
Out[11]:
In [267]:
b='ab34ghf56kty' #中间隔了数字,会被认定为不同的字符串
print(b.title())
print(b.lower())
print(b.upper())
print(b.capitalize())
Out[267]: