Hi method in Python-day3 list, python-day3hi
1. Create a list object correctly
Li = list ([1, 2, 4])
Li2 = list (1, 2, 3, 4 ))
2. append
Result = li. append (5)
3. clear
Result = li. clear ()
4. Copy --- 1. Shallow copy and deep copy
For example, if the list contains a dictionary or list, you can copy only the first layer, and then copy the dictionary or list to the bottom layer as the name suggests.
5. extend -- extended (list, ancestor)
Li = list ([1, 2, 4])
Result = li. extend ([55,55,])
Print (li)
6. insert is added at the specified index location.
Li = list ([1, 2, 4])
Result = li. insert (2, 33)
Print (li)
7. pop removal. The removed value is returned. The last bit is removed by default.
Li = list ([1, 2, 4])
Resulet = li. pop (0)
Print (li)
Print (resulet)
8. remove --- remove from left to right. After the removal, the return value is None.
Li = list ([1, 2, 4])
Print (li)
Result = li. remove (1)
Print (li)
9 reverse: All sequences are reversed.
Li = list ([1, 2, 4])
Print (li)
Result = li. reverse ()
Print (li)
The following learning points are used to practice in scenarios: