How to Convert a String to Lowercase in Python

There are various ways to Lowercase a string in Python but here we are using some generally used methods to convert a string to lowercase:

  • Using lower() Function
  • Using map() with Lambda Function in lower() Method
  • Using List Join with lower() Method
  • Using map and str.lower with lower() Method
  • Using Swapcase() Function 
  • Using casefold() Function

Convert string to lower case using lower() method

Let’s see two different cases of using the lower() method.

  • Strings with Alphabetic Characters
  • Strings with Alphanumeric Characters

String With Alphabetic Characters 

In this example, code initializes a string variable ‘text’ with the value ‘GeEks FOR geeKS’, then prints the original string. It subsequently converts the string to lowercase using the `lower()` function and prints the result, demonstrating the case transformation.

Python3




text = 'GeEks FOR geeKS'
 
print("Original String:")
print(text)
 
# lower() function to convert
# string to lower_case
print("\nConverted String:")
print(text.lower())


Output: 

Original String:
GeEks FOR geeKS
Converted String:
geeks for geeks

String with alphanumeric characters

In this example, the String with Alphanumeric Characters and code defines a string variable ‘text’ with a mixed case. It then prints the original string and, in the next section, prints the string converted to lowercase using the lower() function.

Python3




text = 'G3Ek5 F0R gE3K5'
 
print("Original String:")
print(text)
 
# lower() function to convert
# string to lower_case
print("\nConverted String:")
print(text.lower())


Output: 

Original String:
G3Ek5 F0R gE3K5
Converted String:
g3ek5 f0r ge3k5

Python String lower() Method

Python string lower() method converts all letters of a string to lowercase. If no uppercase characters exist, it returns the original string.

Example:

Python3




string = "ConvErT ALL tO LoWErCASe"
print(string.lower())


Output

convert all to lowercase

Similar Reads

Syntax of String lower()

...

What is the Python String lower() Method?

string_name.lower()...

How to use the Python string lower() Method?

The `lower()` method is a string method in Python. When applied to a string, it converts all the characters in the string to lowercase....

How to Convert a String to Lowercase in Python

To convert all characters of a string to lowercase just call the lower() function with the string. lower() function is an in-built string method and can be used with variables as well as strings. Let’s understand it better with an example:...

Other Methods to Convert String to Lower Case

...

Applications of String lower() method

There are various ways to Lowercase a string in Python but here we are using some generally used methods to convert a string to lowercase:...

Contact Us