THE WORLD'S LARGEST WEB DEVELOPER SITE

Python String swapcase() Method

❮ String Methods


Example

Make the lower case letters upper case and the upper case letters lower case:

txt = "Hello My Name Is PETER"

x = txt.swapcase()

print(x)
Run example »

Definition and Usage

The swapcase() method returns a string where all the upper case letters are lower case and vice versa.


Syntax

string.swapcase()

Parameter Values

No parameters.


❮ String Methods