Home >Backend Development >Python Tutorial >What does swapcase mean in python?

What does swapcase mean in python?

藏色散人
藏色散人Original
2019-06-22 14:21:5116537browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn