Last updated on August 15, 2023
The lower() method converts the string into lowercase. It doesn’t take any required or optional parameters and returns lowercase string values. The lower() method works similarly to the casefold() method.
Syntax
string.lower()
Parameters
It doesn’t take any parameter and directly attaches to the string or variable through the dot notation.
Return Value
The lower() method returns lowercase-based string values.
Usage
You can directly attach the lower() method with the string through the dot notation.
"PROGRAMMING".lower();
To see the result, pass it into the print() function.
print("PROGRAMMING".lower());
# OutPut: programming
In a second way, you can create a variable and store a string.
favoriteColor = "BLACK";
Once it is created then attach the lower() method.
favoriteColor.lower();
It should return a converted lowercase string value. To see the result, you can pass it into the print() function.
print(favoriteColor.lower());
# Output: black
Conclusion
This article demonstrates how Python’s lower() method work. It converts the string into lowercase and returns the string value. To convert a string into lowercase you need to attach the lower() method directly with the string through dot notation. You can also attach it with a variable.