Python String lower()

Created with Sketch.

Python String lower()

Summary: in this tutorial, you’ll learn how to use the Python String lower() method to return a copy of a string with all characters converted to lowercase.

Introduction to the Python String lower() method

The lower() is a string method that allows you to return a copy of a string with all characters converted to lowercase.

The following shows the syntax of the lower() method:

str.lower()

 

The lower() method has no parameters.

Note that the lower() method doesn’t change the original string. It just returns a copy of the original string with all characters converted to lowercase.

If you want to return a copy of a string with all characters converted to uppercase, you use the string upper() method.

Python String lower() method example.

The following example shows you how to use the lower() method to return a copy of a string with all characters converted to lowercase:

s = 'Python Lowercase'
new_s = s.lower()
print(s)
print(new_s)

 

Output:

Python Lowercase
python lowercase

 

Summary

  • Use the Python string lower() method to return a copy of a string with all characters converted to lowercase.

Leave a Reply

Your email address will not be published. Required fields are marked *