Lists List
Add Append
A = ['shangsan','Lisi']a.append (' Wangwu') ## #wangwu增加到尾部
Insert insertion (by index)
A = ['b','C']a.insert (1,'d' # ## # #d插入到列表1的位置The result is: ['b','D ','C']
Addition of Extend iterations
A = ['a','b','C']a.extend ('MNL') The result is: ['a','b','C','m','N','L']
Deletion of the list
Pop is deleted by index and has a return value
A = ['a','b','c',' D ' ]a.pop (2) The result is ['a','b', ' D ']
Remove removes elements directly
A = ['a','b','C']m.remove ( 'a')
Del Delete by index can be sliced delete
A = ['a','b','c',' D ' ]del a[0:1]
Clear Empty List
Changes to the list
Delete First, iterate to add
Direct assignment according to the index
A = ['a','b','C' D' result is ['d','b ','C']
Count List counts
Sort (list is ordered and can be sorted by index)
Sort positive Order
A = [1,5,8,4,6,3,4]a.sort ()print(a) ## #按照大小顺序
Reverse reverse (reverse, from rear to front)
Reverse (in order) A.sort (rever=true)
The list is converted into a string join
A = ['a','b','C'] Print('*'. Join (a)) ### ' * ' delimiter
The result is: a*b*c
Python fifth day