String Methods
casefold()
Return a very thorough lowercase version for case-insensitive text matching.
str.casefold()
str.casefold() returns a case-folded copy of the string designed for aggressive, caseless string matching.
Casefolding is similar to lowercasing, but handles international and Unicode characters (like converting German 'ß' to 'ss') more thoroughly than lower().
Result
Returns
A case-folded string.
Run it
Try it
Run it and change it
word = "Straße" print(word.casefold())
Output
Press Run to see what it prints.Worth knowing
- Caseless equality checks: When comparing user input where case should be ignored across all languages,
text1.casefold() == text2.casefold()is the recommended best practice.