How do I lowercase a string in Python?
You can use the lower() method to lowercase a string in Python.
You can use the lower() method to lowercase a string in Python. Here is an example:
Lowercase a string in Python
python— editable, runs on the server
<div class="alert alert-info flex not-prose">![]()
<span class="hidden md:block">Watch a video course</span>Python - The Practical Guide</div>
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. The following example demonstrates that the original string remains unchanged:
Lowercase a string in Python and printing the original string which remains unchanged
python— editable, runs on the server
This will output HELLO WORLD.