Last updated on March 14, 2023 by Ayaz Ali Shah
Python’s built-in method casefold() converts the string into lowercase. It doesn’t take any parameters and returns lowercase string values.
It doesn’t take any required or optional parameter.
The casefold() method returns lowercase-based string values.
You can directly access the casefold() method with string through the dot notation.
"PYTHON PROGRAMMING LANGUAGE".casefold();
To see the result, pass it into the print function.
print("PYTHON PROGRAMMING LANGUAGE".casefold()); # output: python programming language
You can also store the string into a variable and access the casefold() method.
favoriteColor = "RED"; favoriteColor.casefold();
Similarly, to the result pass it into the print() function.
print(favoriteColor.casefold()); # Output: red
In this article, we explained how does casefold() method work. The casefold() method converts the string into lowercase and it attaches with string or variable through the dot notation.