How would you convert a string into lowercase?
Use the lower() method. It returns a new string with all letters in lowercase. The original string does not change, because strings in Python are immutable.
text = "Hello World"
print(text.lower())
print(text)
Output:
Tutorials Class - Output Window
hello world
Hello World
To change the case the other way, see how to convert a string into uppercase. A common use of lower() is to compare two strings without worrying about capital letters.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |