列表的用法:
'''
列表是有序、可嵌套,元素可重复出现
'''
names = ['grape','bajie','haha','chenglong','wukong',['1','2','3']]
print(names[names.index('grape')]
print(names[0])
print(names[0:2])
print(names[:2])
print(names[-2:-1])
print(names[-2])
names.append('bajie')
print(names)
names.insert(1,'honghaier')
print(names)
names[2]='tangseng'
print(names)
names.remove('lili')
print(names)
names.pop(2)
print(names)
print(names.count('wukong'))
print(names.reverse())
print(names)
names2=['1','2','3']
names.extend(names2)
print(names)
names.sort()
print(names)
print(names)
names3=names.copy()#浅拷贝,只对第一层拷贝。
names[-1][2]=4
names[0]='Grape'
print(names)
print(names3)