swapcase¶
Description¶
Returns a copy of the string with case swapped.
Syntax¶
str. swapcase()
Return Value¶
str
Time Complexity¶
#TODO
Remarks¶
For 8-bit strings, this method is locale-dependent.
Example¶
>>> 'foo'
'foo'
>>> 'foo'.swapcase()
'FOO'
>>> 'Foo'.swapcase()
'fOO'
>>> 'fOo'.swapcase()
'FoO'
>>> '123'.swapcase()
'123'
>>> '!@#'.swapcase()
'!@#'
>>> ' '.swapcase()
' '