Skip to content

Python String lower() Method

How to use Python's string lower() method to convert all characters in a string to lowercase while preserving the original string.

The String lower() method returns a new string with all characters converted to lowercase.

Syntax

my_string.lower()

lower() Parameters

Python String lower() method does not take any parameters.

lower() Return Value

Python String lower() method returns the lowercase string from the given string.

It converts all uppercase characters to lowercase. If no uppercase characters exist, it returns a copy of the original string.

Examples

Example 1: Lowercase a String with lower()

The lower() method returns a new string with all characters converted to lowercase.

my_str = 'Tutorial Reference'
result = my_str.lower()
print(result) # Output: tutorial reference

output

tutorial reference

Example 2: Lowercase a String with Symbols with lower()

The lower() method ignores numbers and special characters in a string.

my_str = '1234 ABC $@%*'
result = my_str.lower()
print(result) # Output: 1234 abc $@%*

output

1234 abc $@%*

Example 3: How to use lower() in a program

For example, let's check if two strings are the same, converting them to lowercase and then checking if they are equals:

str1 = "Tutorial Reference!"
str2 = "TuTORial REFereNCE!"

if(str1.lower() == str2.lower()):
    print("The strings are same.")
else:
    print("The strings are not same.")

output

The strings are same.
Navigation