Python Basic Property functions Learn
Import this: "The Zen of Python"
#: Annotation Characters
# ENCODING=GBK: Chinese input reference
Title (): Each word is displayed in uppercase letters, and the first letter of each word is changed to uppercase.
Upper (): Converts a string to uppercase
Lower (): Converts a string to lowercase
\ t: Tab
\ n: Line break
Rstrip (): Delete the end of the string contains extra white space, delete is only temporarily, and then access the variable value again, still contain extra white space
Lstrip (): Delete the beginning of the string with extra whitespace
Strip (): Remove extraneous whitespace at the beginning of the string
STR (): Convert to String
Append (): Add an element at the end of the list
Del: Delete the list element at any location
Pop (): Deletes the element at the end of the list by default and removes the element from any position in the list based on the incoming subscript, allowing you to continue to use it.
Remove (): Deletes only the first specified value. If the value you want to delete may appear more than once in the list, you need to
Use loops to determine if all such values have been deleted
Sort (): The list is sorted in a permanent order, and the list element is arranged in the reverse sequence, simply passing the parameter to the sort () method Reverse=true
Sorted (): Temporarily sorts the list, displays the list in reverse order, or passes parameters to the function sorted () reverse=true
Reverse (): Reverses the order in which list elements are arranged
Len (): Gets the length of the list
Range (): Starts from the specified first value and stops after the second value you specify, example range (2,11,2)
In this example, the function range () starts at 2 and then continues to add 2 until the final value (11) is reached or exceeded, so
The output is as follows: [2, 4, 6, 8, 10]
List (): Convert to List
Min (): min
Max (): Max
SUM (): Sum
Players[0:3]: You can specify the index of the first element and the last element to be used. As with function range (), Python
Stops after reaching the element that precedes the second index you specify. If you do not specify the first index, Python will automatically start at the beginning of the list.
The second index similarly
Python Learning notes (i)