Python String lower()

Python String lower() is used to convert characters in given string into lowercase. lower() method returns a new string with the characters of this string converted to lowercase.

In this tutorial, we will learn the syntax and examples for lower() method of String class.

Syntax

The syntax to call lower() method on string x in Python is

</>
Copy
x.lower()

Examples

In the following program, we take a string 'Hello World', and convert this string into lowercase using lower() method.

Example.py

</>
Copy
x = 'Hello World'
result = x.lower()
print('Original String  : ', x)
print('Lowercase String : ', result)

Output

Original String  :  Hello World
Lowercase String :  hello world

If there are no lowercase letters in this string, the returned string is same as the given string.

In the following program, we take a string 'hello world', and convert this string into lowercase using lower() method. Since, there are no uppercase letters in this string to convert to lowercase, the returned string should be same as that of original string.

Example.py

</>
Copy
x = 'hello world'
result = x.lower()
print('Original String  : ', x)
print('Lowercase String : ', result)

Output

Original String  :  hello world
Lowercase String :  hello world

Conclusion

In this Python Tutorial, we learned how to convert a string to lowercase using lower() method, with examples.