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 referenceoutput
tutorial referenceExample 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.