Function Details: swapcase

Description

Returns a copy of the string with uppercase characters converted to lowercase and vice versa.

Extended Description

swapcase is a Python string method that inverts character case - lowercase becomes uppercase and vice versa. Works as complement to upper and lower in text transformations. Unlike title and capitalize which follow specific patterns, it simply toggles existing case. Often used with strip for text cleanup and casefold for Unicode handling. Useful in text processing, pattern matching, and special text effects. Creates new string instance preserving original data.


Read More about swapcase from Python Documentation

Function Signature



Module: builtins

Class: str

Parameters



Return



Return Type


str

Output

Explanation