Home / Python / Reference / String methods

Python string casefold() method

A stronger lower(), for comparing text in any language.

Syntax

str.casefold()

Like lower, but also handles special cases such as the German ß. Use it for case-insensitive comparisons of international text.

Parameters

None.

Return value

str

Example

Code

print("Straße".lower(), "Straße".casefold())
print("STRASSE".casefold() == "Straße".casefold())

Output

straße strasse
True

Related

Learn it step by step in the free lesson Strings, with exercises that check your answers.