Detailed explanation of Python lower function: convert string to lowercase letters

Detailed explanation of Python lower function: convert string to lowercase letters

In Python, string is a common data type used to store text data. String objects have many built-in methods, one of which is lower()a function. lower()Function converts all letters in a string to lowercase and returns a copy of the converted string.

Below we will introduce lower()the use of the function in detail and provide corresponding source code examples.

lower()function syntax

lower()The function does not accept any parameters and its syntax is as follows:

string.lower()

lower().Functions are methods of string objects, and are called in association with string objects through the dot operator ( ).

lower()Example of function

Let's demonstrate the usage of the function through a few examples lower().

Example 1:

string = "Hello, World!"
lower_string 

Guess you like

Origin blog.csdn.net/qq_33885122/article/details/132806586