How to Convert a String to Lowercase in Python?

Spread the love

Problem –

You want to convert a string to lowercase in python.

Solution –

To convert a string to lowercase in python, we can use the string.lower() method. The lower() method converts all uppercase characters in a string to lowercase characters and returns it.

Syntax –

string.lower()

Example –

In [1]: string1 = 'WE LOVE PYTHON'

In [2]: string1.lower()
Out[2]: 'we love python'

In [3]: string2 = 'We Love Python'

In [4]: string2.lower()
Out[4]: 'we love python'

Rating: 1 out of 5.

Leave a Reply