List:
Definition list:
shoppinglist=[' car ', ' clother ', ' iphone ']
0 1 2
Remove Clother from the list
SHOPPINGLIST[2]
Like the last add in the list
Shoppinglist.append (' Oldboy ')
Insert Insert 2 in front of image list
Shoppinglist.insert (' 2 ', ' Oldboy ')
Count, find how many times Oldboy appear in the table
Shoppinglist.count (' Oldboy ')
The count can be used as a judgment: no return 0
There is no oldboy in the judging list:
' Oldboy ' in shoppinglist
Query index, return the position of Oldboy in the list
Shoppinglist.index (' Oldboy ')
Delete (if there are more than one in the list, the first one is deleted by default)
Shoppinglist.remove (' Oldboy ')
Delete Last
Shoppinglist.pop ()
Sort
Shoppinglist.reverse ()
Sort by alphabet
Shoppinglist.sort ()
modifying list data
shoppinglist[1]= ' Oldboy '
For example:
I=shopping.index (' Oldboy ')
shopping[i]= ' Newoldboy '
To generate a list of string variables:
names = "Alex Dongxu feiferi"
Names_list=names.split ()
Built-in function min, the minimum value given in the search list
Main (list)
Meta-group:
Tuples are the same as lists, but not tuple one but the build cannot be modified
Python list and tuple operations