1、大写改为小写
>>> test1 = "abCDEfg" >>> test1 'abCDEfg' >>> test1.upper() 'ABCDEFG'
2、小写变大写
>>> test1 'abCDEfg' >>> test1.lower() 'abcdefg' >>> test1 'abCDEfg' >>> test1.casefold() 'abcdefg'
3、首字母改为大写
>>> test1 'abCDEfg' >>> test1.capitalize() 'Abcdefg' >>> test1 'abCDEfg' >>> test1.title() 'Abcdefg'
4、大写变小写、小写变大写
>>> test1 'abCDEfg' >>> test1.swapcase() 'ABcdeFG'