Python OOPs


Python SQLite


Examples


Others


casefold() method in Python


The 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. But casefold() converts it to 'ss' (German letter 'ß' is equivalent to English string 'ss').

Syntax
string.casefold()

The following example shows, how works the casefold() method.

Example
txt="ß is German LETTER"

print("lower() method result is  : ",txt.lower())

print("casefold() method result is : ",txt.casefold())

Output

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.

Python String Methods