002 list and metadata, 002 list tuples
It should be similar to array, but there are many built-in methods.
# Definition
A = ["wuchao", "jinxing", "123", "456", "789", "110"]
Basic operations
# Slice
Print (a [1: 4])
Print (a [2:]) # If the last one is null, the last one is obtained. If it is-1, the last one is obtained, and so on.
Print (a []) # Add a step. If the step size is negative, the system starts to retrieve the index number of the first parameter and the index number of the second parameter.
# Here is the index number starting from 4th, with the number of steps being 2, to the left (tail), that is, the position of "jinxing"
# Add appendinsert
A. append ("qing") # append to the last position
A. insert (-1, "hua") # add to any location
Extend, also add Method
# Batch Modification
A [3: 5] = ["xiongdi", "qizi"]
# Delete removepopdel
A. remove ("wuchao") # Delete by value
B = a. pop (2) # deleting an index will return a value. If no index is specified, the last one will be deleted.
Dela [] # Powerful Deletion
Built-in Method
# Count method
Num = a. count ("qing") # There are 2 qing
# Extend Method
X = [1, 2, 3]
Y = [4, 5, 6]
X. extend (y) # x adds elements in y
# Index Method
Print (a. index ("qing", a. index ("qing") + 1 ))
# Reverse method, invert
A. reverse ()
# Sort method sorting method
X. sort (reverse = True)
# Not in
Print ("hua" in)
# Clear the content
X. clear ()
# Checking whether the list is correct
Type (x) islist