Python‎ > ‎str‎ > ‎

str.swapcase()


Definition
Return a copy of S with uppercase characters converted to lowercase and vice versa.

Syntax
str.swapcase() -> str

Parameters
str=string


Examples
Return is:
 >>> "Python Lake".swapcase()
'pYTHON lAKE'
>>> 
>>> "Adil Waseem".swapcase()
'aDIL wASEEM'
>>>

The returns are following:
>>> x="Python Lake"
>>> x.swapcase()
'pYTHON lAKE'
>>> str.swapcase("Python Lake")
'pYTHON lAKE'
>>> str.swapcase(x)
'pYTHON lAKE'
>>> x.swapcase().__eq__('pYTHON lAKE')
True
>>> x.swapcase()=='pYTHON lAKE'
True
>>>

Comments