Skip to content
String Methods

swapcase()

Return a copy with uppercase and lowercase letters swapped.

str.swapcase()

Return a copy with uppercase and lowercase letters swapped.

Returns

A new string with the case of each cased character reversed.

Try it

Run it and change it
text = "PyTHON"
print(text.swapcase())

Related entries