Swapping uppercase and lowercase in a string [duplicate]

If you want to invert the case of that string, try this:

>>> 'AltERNating'.swapcase()
'aLTernATING'

Leave a Comment