Python String lower()
Python String lower() method
Python String lower() method is used to convert all the cased characters in the string to lower case.
Consider that given string is in x.
x = "HELLO World!"
Then the return value of x.lower() is
"hello world!"
In this tutorial, you will learn the syntax and usage of String lower() method in Python language.
Syntax of lower() method
The syntax of String lower() method in Python is given below.
str.lower()
Parameters
The lower() method takes no parameters.
Return value
lower() method returns a new string value created by converting the cased characters in the given string to lower case.
Examples
1. lower() - Convert given Python string to lower case
In the following program, we take a string in variable x. We have to covert this string to lower case.
Call lower() method on the string x and store the returned value in x_lower.
Python Program
x = "HELLO World!"
x_lower = x.lower()
print(f"Given string : {x}")
print(f"Lower string : {x_lower}")
Output
Given string : HELLO World!
Lower string : hello world!
Summary
In this tutorial of Python String Methods, we learned about String lower() method, its syntax, and examples.