Python String Casefold() Method

Last updated on March 14, 2023

Python’s built-in method casefold() converts the string into lowercase. It doesn’t take any parameters and returns lowercase string values.

Syntax

string.casefold()

Parameters

It doesn’t take any required or optional parameter.

Return Value

The casefold() method returns lowercase-based string values.

Usage

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

Conclusion

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.


Written by
I am a skilled full-stack developer with extensive experience in creating and deploying large and small-scale applications. My expertise spans front-end and back-end technologies, along with database management and server-side programming.

Share on:

Related Posts

Tags: Python,