Python string swapcase() method
Swap upper and lower case.
Syntax
str.swapcase()
Strings cannot change, so this returns a new string; keep it with s = s.swapcase(…).
Parameters
None.
Return value
str
Example
Code
print("Hello World".swapcase())
Output
hELLO wORLD
Related
Learn it step by step in the free lesson Strings, with exercises that check your answers.