Create list:l = [' Adam ', ' Lisa ', ' Bart ', ' gechong ', ' kongming ']
Show List:l[0]
Traversing List:print (L) and for loops
Update List:append () and insert () and direct assignment
Delete List:pop () and pop (n)
List features:
can add delete
Li = [' Adam ', ' Lisa ', ' Bart ', ' gechong ', ' kongming ']print (LI) for name in Li:print (name)
Create Tuple:tu = (' Adam ', ' Lisa ', ' Bart ', ' gechong ', ' kongming ')
Show Tuple:tu[0]
Traversing Tuple:print (Tu) and for loops
Update tuple: cannot be updated
Delete tuple: cannot be deleted
Tuple characteristics: Can not be changed, if you create a tuple after an element, to add ","
Tu = (' Adam ', ' Lisa ', ' Bart ', ' gechong ', ' kongming ') print (TU) for name in Tu:print (name)
Create Dict:di = {' Adam ': +, ' Lisa ': +, ' Bart ': ", ' Gechong ':", ' kongming ': 100}
Show dict:di[' Adam '] and Di.get (' Adam ')
Traversing Dict:print (Di) and for loops
Di = {' Adam ': +, ' Lisa ': +, ' Bart ': ' Gechong ': +, ' kongming ': 100}for key in Di:print (key)
Di = {' Adam ': +, ' Lisa ': +, ' Bart ': ' Gechong ': +, ' kongming ': 100}for key in Di:print (Di[key])
Update Dict: Assign a value to the corresponding location
Delete dict:
Dict Features:
1: Fast Search speed
2: Wasted Space
3:key can not be repeated, and not variable
4: Data disordered emissions
Create set:s = set ([' Adam ', ' Lisa ', ' Bart ', ' gechong ', ' kongming ')
Show set:
s = set ([' Adam ', ' Lisa ', ' Bart ', ' gechong ', ' kongming ') ') if ' test ' in S:print (' Test ') else:print (' No ')
Traverse Set:print (s)
s = set ([' Adam ', ' Lisa ', ' Bart ', ' gechong ', ' kongming ') ') for name in S:print (name)
Update Set:s.add ()
Delete Set:s.remove ()
Python List+tuple+dict+set Summary