将小写字母大写,大写字母小写:
txt = "Hello My Name Is ELON"x = txt.swapcase()print(x)
txt = "Hello My Name Is ELON"
x = txt.swapcase()
print(x)
swapcase() 方法返回一个字符串,其中所有大写字母均成为小写字母,反之亦然。
swapcase()
string.swapcase()
无参数