Home >>Python String Methods >Python String swapcase() Method

Python String swapcase() Method

Python String swapcase() Method

Python string swapcase() method is used to return a string where all the upper case letters are changed into lower case and all the lower case letters are changed into upper case.

Syntax:
string.swapcase()
Here is an example of Python swapcase() method:

txt = "Hello everyone.. My Name Is Jerry"
x = txt.swapcase()
print(x)

Output:
hELLO EVERYONE.. mY nAME iS jERRY

No Sidebar ads