Python String lower()

Python String lower() method converts all the uppercase characters in a string to lowercase characters and returns the string as output.

lower() Syntax

The Syntax of lower() method is:


lower() Parameters

The lower() method doesn’t take any parameters.

lower() Return Value

In Python string lower() method converts all the uppercase characters in a string to lowercase and returns the output of the string.

The lower() method will return the original string if the string doesn’t have any uppercase.

Example 1: Convert a string to lowercase

The following program converts all the uppercase characters in a string to lowercase.

# Program to convert uppercase characters to lowercase
text= "ItsMYCode Coding Simplified"
print('Original String: ',text)
print('Original String: ',text2)

print('Lowercase String: ',text.lower())
print("Lowercase String: ", text2.lower())


Original String:  ItsMYCode Coding Simplified
Original String:  HELLO WORLD
Lowercase String:  itsmycode coding simplified
Lowercase String:  hello world

Example 2: String with Alphanumeric characters

If the string contains numeric/digits, the lower() method will return as is. Only the characters with uppercase will be converted to lowercase and returned.

Note: The same logic applies to even symbols and special characters. Apart from uppercase, none of the other characters will be converted. It will be returned as-is.

# Program to convert Alphanumeric characters to lowercase
text= "Its 2:00PM IST in India"
print('Original String: ',text)
print('Lowercase String: ',text.lower())


Original String:  Its 2:00PM IST in India
Lowercase String:  its 2:00pm ist in india

Example 3: How to check if two strings are same in Python

Let’s take a look at real-time examples of when exactly we use the string lower() method. Generally, there are many use cases where we need to check if two strings are the same.

In the below use case, we check if the email address and the re-entered email address are the same or different.

# Program to check the email and re-enterd email is same or different
email= ""

if(email.lower() == confirmemail.lower()):
    print("Email Address are same")
    print("Email Address are not same")


Email Address are same
Leave a Reply

Your email address will not be published. Required fields are marked *

Sign Up for Our Newsletters

Subscribe to get notified of the latest articles. We will never spam you. Be a part of our ever-growing community.

You May Also Like