Python String lower() Method
Python String lower() method converts all uppercase characters in a string into lowercase characters and returns it.
Syntax:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
string.lower()
Parameters:
The lower() method doesn’t take any parameters.
Returns:
Returns a lowercased string of the given string
Example 1: String with only alphabetic characters
Python3
# Python3 program to show the# working of lower() functiontext = 'GeEks FOR geeKS'print("Original String:")print(text)# lower() function to convert# string to lower_caseprint("\nConverted String:")print(text.lower()) |
Output:
Original String: GeEks FOR geeKS Converted string: geeks for geeks
Example 2: String with Alphanumeric Characters
Python3
# Python3 program to show the# working of lower() functiontext = 'G3Ek5 F0R gE3K5'print("Original String:")print(text)# lower() function to convert# string to lower_caseprint("\nConverted String:")print(text.lower()) |
Output:
Original String: G3Ek5 F0R gE3K5 Converted String: g3ek5 f0r ge3k5
Example 3
One of the common applications of the lower() method is to check if the two strings are the same or not.
Python3
# Python3 program to show the# working of lower() functiontext1 = 'GEEKS For GEEKS'text2 = 'gEeKS fOR GeeKs'# Comparison of strings using# lower() methodif(text1.lower() == text2.lower()): print("Strings are same")else: print("Strings are not same") |
Output:
Strings are same


