How do I lowercase a string in Python?
You can use the lower()
method to lowercase a string in Python. Here is an example:
Watch a video course
Python - The Practical Guide
This will output hello world
. Note that the lower()
method does not modify the original string, it returns a new string with all the characters in lowercase. If you want to update the original string, you can assign the result of the lower()
method back to the original variable:
This will also output hello world
.