upper() 方法:将字符串中的小写字母转换为大写字母 lower() 方法:将字符串中的大写字母转换为小写字母 swapcase() 方法:将字符串中的大写字母转换为小写字母,将小写字母转换为大写字母 title() 方法:将字符串中每个单词的首字母转换为大写字母,其他字母转换为小写字母
s="abcdefg"
print(s.upper())
print(s.swapcase())
print(s.title())
t="ABB"
print(s.lower())
结果:
ABCDEFG
ABCDEFG
Abcdefg
abcdefg