Lowercase a string in Python

Problem description

How to lowercase a string in Python?

Problem solution

Python's built-in str.lower() method will be perfect for this example. See how you can use it:

str1 = "Example"
str2 = "EXAMPLE"
srt3 = "example" 

print(str1.lower()) # output: "example"
print(str2.lower()) # output: "example"
print(str3.lower()) # output: "example"

As you can see, it doesn't matter how many uppercase word have, after using lower() all of them will be lowercase.

We collect traffic information to improve the site.

Anonymous analytics only. No ads, no cross-site tracking.

Learn more