Python String casefold() Method Tutorial

In this section, we will learn what String casefold() method is and how to use it in Python.

What is String casefold() Method in Python?

The Python string casefold() method is used to convert all the characters of a string into lowercase.

The string lower() method does the same job, but the difference is that the casefold() method put more work and aggressively tries to convert characters to their lowercase version.

For example, the German character `ß` is already a lowercase letter and if we use the lower() method there won’t be any difference. But if we apply the casefold() method on it, the result will be “ss”.

Python String casefold() Method Syntax:

stringValue.casefold();

String casefold() Method Parameter

The method does not take an argument.

String casefold() Method Return Value

The return value of this method is a copy of the lowercase characters of the target string value.

Example: using string casefold() method in python

s1 = "THIS IS A STRING VALUE"

result = s1.casefold()

print(result)

Output:

this is a string value
Facebook
Twitter
Pinterest
LinkedIn

Top Technologies