参考文章:https://blog.csdn.net/xxzhangx/article/details/52695089
小写转大写:upper
把所有字符中的小写字母转换成大写字母
>>> str = "hELLO world!"
>>> print (str.upper())
HELLO WORLD!
- 1
- 2
- 3
大写转小写:lower
把所有字符中的大写字母转换成小写字母
>>> str = "hELLO world!"
>>> print (str.lower())
hello world!
- 1
- 2
- 3
第一个字母转为大写:capitalize
把第一个字母转化为大写字母,其余小写
>>> str = "hELLO world!"
>>> print (str.capitalize())
Hello world!
- 1
- 2
- 3
每个单词的第一个字母大写:title
把每个单词的第一个字母转化为大写,其余小写
>>> str = "hELLO world!"
>>> print (str.title())
Hello World!