How to Use the swapCase () method to convert case sensitivity in Python
This article describes how to use the swapCase () method to convert the case sensitivity in Python. It is a basic knowledge in Python. For more information, see
The swapCase () method returns all uppercase and lowercase characters. A copy of the string is exchanged Based on uppercase and lowercase characters.
Syntax
The following is the syntax of the swapCase () method:
?
Parameters
NA
Return Value
This method returns a copy of all the string based on case-insensitive characters.
Example
The following example shows how to use the swapCase () method.
?
1 2 3 4 5 6 7 |
#! /Usr/bin/python Str = "this is string example... wow !!! "; Print str. swapcase (); Str = "this is string example... WOW !!! "; Print str. swapcase (); |
When we run the above program, it will produce the following results:
?
1 2 |
This is string example... WOW !!! This is string example... wow !!! |