Skip to main content

Python String lower() Function

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

note

This method does not change the original string.

note

If you want to convert to uppercase string, use upper() method. You can also use swapcase() to swap between lowercase to uppercase.

Syntax

my_string.lower()

lower() Parameters

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

lower() Return Value

Python String lower() function 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.