my_string = "Hello, World!" lowercase_string = my_string.lower()
To lowercase a string in Python, you can use the lower() method. This method returns a new string with all the characters of the original string converted to lowercase.Note that the lower() method does not modify the original string. It returns a new string with the lowercase characters. If you want to modify the original string, you can assign the result of the lower() method back to the original variable. Here is an example:
my_string = "Hello, World!" my_string = my_string.lower() # this will convert the original string to lowercase
Learn Flask development and learn to build cool apps with our premium Python course on Udemy.