| L=[] |
Definition List |
L=[' A ', 2,[' B ', ' c,d '] |
| L=list (...) |
Definition List |
|
| L=[c * 4 for C in ' Hal '] |
Definition List |
|
| L.append () |
Add new member at the end of list, list, dictionary function new member |
L.append ([' A ', 2, ' B ') |
| L.clear () |
Clear List |
L.clear () |
| L.copy (value) |
Copy List |
L.copy () |
| L.count (value) |
Count the number of times a member appears in a list |
L.count (' B '), L.count (L1, 2) |
| L.extend (value) |
Add new content (in the case of a list, a dictionary, the |
L.extend ([3,{4,5}]) |
|
Dictionaries, members of the list are added to the original list, and their |
|
|
The child list functions as a whole add). If the type (value |
|
|
=list is merged, if type (value) is =set, then |
|
|
The values in the dictionary are added in reverse order, and if it is a string, go |
|
|
Merged into a dictionary. |
|
|
List cannot be added such as L.extend ({4,[' a '}) |
|
| L.index (Value,[start,[stop]) |
Returns the index number corresponding to the value in the list. In. |
|
|
Start–> stop between if there is no need to find |
|
|
The value, then the error |
L.index ({4,5}) |
| L.insert (Index,object) |
Add a new list member before the specified index location |
L.insert (2,{' A ', ' B '}) |
| L.pop ([index]) |
Deletes the content according to the index location. |
|
|
The value of index must be a single integer, not a list, word |
|
|
In the form of a code, that is, you can delete only one list at a time |
|
|
Members. An error if the specified index does not exist. If you do not refer to |
L.pop (3) |
|
Index value, the last member is deleted by default. |
|
| L.remove (object) |
Exclude members from the list. Object must be a full member |
L.remove ({' A ', ' B '}) |
| L.reverse () |
Order list members in reverse order |
L.reverse () |
| L.sort (Key=none,reverse=false)) |
The method is sorted by default in ascending order. When Reverse=ture, enter |
|
|
Row reversed order. But python3.0 a little bit different before and after: |
|
|
before 3.0, the ordering between different elements is allowed . |
|
|
After 3.0, different types of list elements are not allowed to be sorted |
L.sort () |