List is the most flexible set of ordered collection object types in Python
It can contain objects of any other type: numbers, strings, even lists
Features: Variable objects, can be modified in situ, can be offset values, shards, method calls
Characteristics:
1. An ordered set of arbitrary objects
2. Read by offset
3. Variable-length, heterogeneous, and arbitrary nesting
4. Belong to the variable sequence
5. Object reference array: A list contains references to 0 or more objects
| Operation |
Explain |
| L=[] |
An empty list |
| l=[0,1,2,3] |
Four items: index from 0 to 3 |
| l=[' abc ', [' 123 ', ' ABC '] |
Nested from List |
| L=list (' abc ') |
List of items that can be iterated |
| L=list (range (0,4)) |
List of items that can be iterated |
| L[i] |
Index |
| L[I][J] |
Index of Index |
| L[I:J] |
Sharding |
| Len (L) |
Request length |
| L1+l2 |
Add |
| L*3 |
Repeat |
| For x in L:print (x) |
Iteration |
| 3 in L |
Member relationships |
| L.append (1) |
Growth |
| L.extend ([1,2,2]) |
Growth |
| L.insert (i,x) |
Insert |
| L.index (1) |
Search |
| L.count (X) |
Total |
| L.sort () |
Sort |
| L.reverse () |
Reverse |
| Del L[k] |
Delete Element |
| Del L[i:j] |
Delete scope |
| L.pop () |
Pop |
| L.remove (2) |
Remove |
| L[i:j]=[] |
Empty |
| L[i]=1 |
Index Assignment |
| l[i:j]=[1,2,3] |
Shard Assignment |
| L=[x**2 for x in range (1,4)] |
List parsing |
Right here, thank you.
------------------------------------------------------------------
Click to jump 0 basic python-Catalogue
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
0 python-8.1 List of basic studies