Python lower() Function: Convert String to Lowercase
In Python, the lower() function is used to convert all characters in a string to lowercase letters. Below is a detailed explanation of the lower() function.
- Syntax: str.lower()
- Parameter: lower() is a method of the string object (str) and does not require any additional parameters.
- Return value: A new string is returned, where all characters from the original string are converted to lowercase.
- text = “Hello, World!”
modified_text = text.lower()
print(modified_text)Output:
hello, world!
By using the lower() method, you can easily convert all characters in a string to lowercase, which is useful for ignoring case when comparing strings or normalizing string inputs.