To convert a string to lowercase in Python, you can use the lower()
method.
In this example,
str
with the value "Hello World"
.lower()
on str
and store the result in a new variable lowercase_str
.lowercase_str
.str = 'Hello World'
lowercase_str = str.lower()
print(lowercase_str)
hello world
In this example,
str
with the value "Python Programming"
.lower()
on str
and store the result in a new variable lowercase_str
.lowercase_str
.str = 'Python Programming'
lowercase_str = str.lower()
print(lowercase_str)
python programming
In this tutorial, we learned How to convert String to Lowercase in Python language with well detailed examples.