python中upper,lower用法

#upper()字符串中字母由小写变为大写
#lower()字符串中字母由大写变为小写

>>>s = 'Hello World!'
>>>s.upper()
'HELLO WORLD!'
>>>s.lower()
'hello world!'
>>>s.capitalize()      #首字母大写
'Hello world!'
>>>s.lower().title()   #title()每单词首字母大写

猜你喜欢

转载自www.cnblogs.com/ilyou2049/p/11100941.html
今日推荐