Home > Article > Backend Development > Uppercase to lowercase function in python
In Python, the lower() function converts uppercase letters in a string to lowercase. This function does not alter the original string, but returns a new string in which all uppercase letters have been converted to lowercase. It is a built-in method of a string object and can be called directly on the string. For example, convert "HELLO WORLD" to "hello world":
In Python, you can use the lower() function to convert uppercase letters in a string are lowercase letters. The following is the basic usage of the lower() function:
# 将字符串中的大写字母转换为小写字母 string = "HELLO WORLD" lower_string = string.lower() print(lower_string) # 输出:hello world
In this example, the lower() function converts the uppercase letters in the string "HELLO WORLD" to lowercase letters and stores the result in the lower_string variable .
The lower() function is a built-in method of the string object. It can be called directly on the string. It does not change the original string, but returns a new string in which all uppercase letters are replaced. Convert to lowercase letters.
In general, the lower() function is a common method in Python for converting uppercase letters in a string to lowercase letters.
The above is the detailed content of Uppercase to lowercase function in python. For more information, please follow other related articles on the PHP Chinese website!