python中字符串的大小写转换
作者:互联网
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'
标签:test1,Abcdefg,python,abcdefg,大写,大小写,小写,abCDEfg,字符串 来源: https://www.cnblogs.com/liujiaxin2018/p/14724794.html