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)
Try it Yourself »

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

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.