Home > Article > Backend Development > What does swapcase mean in python?
#What does swapcase mean in python?
The Python swapcase() method is used to convert uppercase and lowercase letters in a string.
swapcase() method syntax:
str.swapcase();
Parameters
NA.
Return value
Returns the new string generated after converting uppercase and lowercase letters.
The following examples show how to use the swapcase() function:
#!/usr/bin/python str = "this is string example....wow!!!"; print str.swapcase(); str = "THIS IS STRING EXAMPLE....WOW!!!"; print str.swapcase();
The output results of the above examples are as follows:
THIS IS STRING EXAMPLE....WOW!!! this is string example....wow!!!
Related recommendations: "PythonTutorial》
The above is the detailed content of What does swapcase mean in python?. For more information, please follow other related articles on the PHP Chinese website!