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

What does swapcase mean in python?

藏色散人
Release: 2019-06-22 14:21:51
Original
16539 people have browsed it

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();
Copy after login

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();
Copy after login

The output results of the above examples are as follows:

THIS IS STRING EXAMPLE....WOW!!!
this is string example....wow!!!
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template