In an ordered list of data, set the various data types, you can add elements to the list, you can also modify the elements inside the list, you can delete the elements inside the list, append (), insert (), remove (), pop (), and Global del Delete.
1, List added
N1=[' A ', ' B ', ' C ']
N1.append (' d ')
Append append, add an element to the list at the end
Insert () insertion means that you can add an element to any location, using insert (0, ' BB ')
2, List modification
n2=[1,2,3,4]
n2[0]=2
How to re-assign a value using subscript index
3, deleting elements
n3=["www.96net.com.cn", ' www.dc3688.com ', ' www.baidu.com ']
N3.pop ()
N3.remove ("www.baidu.com")
DEL N3[0]
In summary list of common operating methods to remember, be sure to do hands-on exercises
Article reprint (JIU le network http://www.96net.com.cn/)
Python Learn list of days add, modify, delete operation method