Sensitive function title, capitalize, ower, upper

title(),capitalize(),lower(),upper()

String uppercase first letter, title strings can only be used above capitalize () the first character of the whole text of the capital upper () all uppercase letters lower () all lowercase letters

In [11]:
a=['tre','ert','dfr','dfg']
[name.title() for name in a]
 Out[11]:
['Tre', 'Ert', 'Dfr', 'Dfg']
In [267]:
  B = 'ab34ghf56kty' # in the interval of numbers is identified as a different string
print(b.title())
print(b.lower())
print(b.upper())
print(b.capitalize())
 Out[267]:
Ab34Ghf56Kty
ab34ghf56kty
AB34GHF56KTY
Ab34ghf56kty

Guess you like

Origin www.cnblogs.com/liyun1/p/11242041.html