casefold() method in Python
casefold() method returns a string where all the characters are in lower case. It is more simillar to the
lower() method but the
casefold() method is more aggressive it will converts more characters into lower case.
For example, the German letter 'ß' is already in lowercase. So the
lower() method is would do nothing on this alphabet.
casefold() converts it to 'ss' (German letter 'ß' is equivalent to English string 'ss').
The following example shows, how works the casefold() method.
txt="ß is German LETTER" print("lower() method result is : ",txt.lower()) print("casefold() method result is : ",txt.casefold())
lower() method result is : ß is german letter casefold() method result is : ss is german letter
In the above example, since ß has been already in lowercase, the
lower() would do nothing. But,
casefold() method converts it to ss.