当前位置:网站首页>Modify the case of the string title(), upper(), lower()

Modify the case of the string title(), upper(), lower()

2022-06-26 04:50:00 I am a little monster

title(): Capitalize the first letter of each word , The space between words can be used 、 Slashes, etc .

upper(): Make every letter capitalized .

lower(): Make each letter lowercase .

>>> s='wo shi xiaoguaishou'
>>> s.title()
'Wo Shi Xiaoguaishou'
>>> sss='wo\shi\ xiaoguaoshou'
>>> sss.title()
'Wo\\Shi\\ Xiaoguaoshou'

>>> ss=s.upper()
>>> ss
'WO SHI XIAOGUAISHOU'

>>> ss.lower()
'wo shi xiaoguaishou'

 

原网站

版权声明
本文为[I am a little monster]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202180510153621.html