swapcase()
Python String swapcase() Method
Last Updated : 2 Jan 2026
Python swapcase() method converts case of the string characters from uppercase to lowercase and vice versa. It does not require any parameter and returns a string after case conversion.
Syntax of Python String swapcase() Method
It has the following syntax:
Parameters
No Parameter
Return
It returns a string.
Different Examples for Python String swapcase() Function
Let's see some examples of swapcase() method to understand it's functionality.
Example 1
It is a simple example to convert uppercase to lowercase using the swapcase() method.
Output:
Example 2
This example describes conversion from lowercase to uppercase.
Output:
Example 3
If the string is in camelcase, the output of this method also would be in camelcase. All the lowercase will be converted to uppercase and vice versa.
Output: