List list=[], such as: member[' 1 ', 2, ' hello ', list can contain different data types
Some common ways to list:
add element:
Append (), insert a new element at the end of the list, such as Member.append (' Tony '),
Extend (), insert a new list at the end of the list, such as Member.extend ([' VR ', ' it '])
Insert (), inserts a new element in the list's location, such as Member.insert (4, ' like ')
To delete an element:
Remove () to delete an element specified in the list, such as Member.remove (' like ')
Del, this is a statement that deletes the index value of an element, such as Del Member[1]
Pop (), delete the last element in the list, and return this value, such as Member.pop (), delete the ' it ' element, and return it, or add the index value of the element in parentheses to delete it
Shard elements:
Member2 = Member[x:y], you can get a list copy of the X-to-y index value, [:] To get a complete copy
Other methods:
Reverse () The original list is inverted, sort () function, by default, the list of elements, according to the order from small to large, if you need to from large to small, you can use List.sort (reverse=ture)
The tuple tuple= (), which is very similar to the list listing, is a list that cannot be modified, but can be sliced to generate a new tuple in the update
Python's list of learning notes and tuples