python中upper,lower用法

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

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

 

posted @ 2019-06-28 09:32  超越吧  阅读(3004)  评论(0编辑  收藏  举报