assigning values to variables
Python is a weakly variable language that does not specify the type of the variable, and its type is determined by the value.
How to assign a variable to a value:
1, directly assigned value
A = 1
2, chain-assigned value
A = b = 1
3. sequence unpacking assignment
A, B =
Note: The number of sequence unpacking assignment variables and values must be consistent
List
A list is an ordered, modifiable sequence of elements that are separated by commas and enclosed in brackets.
List-defined methods:
1. List
2. []
3. Range
4,xrange
Note: in Xrange is canceled in Python3, but the effect of range is consistent with xrange.
Index of the list
The index of the list is similar to the index of the string, but not exactly the same, because the list can be modified, so the list can be modified by the index.
1, the index of the list
2, the modification of the list
List of methodsAdding a list
1. Append Add an element or a set of lists at the end of the list
2. Extend appends the elements of the specified sequence to the end of the list, noting that the specified sequence can only be a list
3. Insert inserts the specified element into the specified index
deletion of the list
1pop Popup Delete element on specified index, delete -1 index element by default
2. Remove removes a specified element from left to right, deleting only one
3,del Python built-in delete function, not the list of unique features
Lookup of lists
1,count counts the number of occurrences of the specified element in the string
2. Index finds the index position of the first occurrence of the specified element in the string and cannot find an error
sort the list
1,reverse the position of the index flashbacks, that is, the string is arranged backwards
2. Sort arranges the elements in the string in the order of the ASCII code table
List definition, index, add, delete, find, sort