We can convert a string to lowercase in Python using str.lower() function. In this short tutorial, we will learn how to convert python string to lowercase.

Python String to Lowercase

Let’s look at a simple example of converting a string to lowercase and print it.

print('Lowercase String =', s.lower())
print('Original String =', s)


Lowercase String = 987abcdef%$
Original String = 987abcDEF%$

Notice that when we call lower() on a string object, the original string remains unchanged. This function creates another string with lowercase characters and returns it. Special characters and numbers are unchanged because they don’t have uppercase and lowercase versions.

Python String lower() with user input

Let’s have a look at another example where we will get the user input and convert it to lowercase string and print it.

s = input('Please Provide Input Stringn')
print('Input String in Lowercase=", s.upper())
print("Original String =', s)


Please Provide Input String
Java is Nice!!
Input String in Lowercase = java is nice!!
Original String = Java is Nice!!
You can checkout complete python script and more Python examples from our GitHub Repository.

Reference: API Doc

By admin

Leave a Reply

%d bloggers like this: