Swap case for string in Python

Swap string case

swapcase allows us to swap string case. It has the following syntax.

s.swapcase() Converts all lowercase letters to uppercase, and vice versa.


s = 'Java2S.com';
print s
print s.swapcase()

The code above generates the following result.





















Home »
  Python »
    Data Types »




Data Types
String
String Format
Tuple
List
Set
Dictionary