str.casefold
Convert the string to a form for case-insensitive comparison.
Python 3.13
str.casefold()Return value
A new string; the original is not changed.
Examples
The German ß
Python 3.13
print('Straße'.casefold())strasse
Case-insensitive comparison
Python 3.13
print('STRASSE'.lower() == 'straße'.lower())
print('STRASSE'.casefold() == 'straße'.casefold())False True
Details
It is similar to str.lower but handles special cases: the German ß becomes ss. The result is meant for comparison, not for showing to the user.
