1. pop():括号中不加参数表示删除列表最后一个元素,也可以加下标参数删除
players = ['charles','martina','michael','florence','eli']
players.pop()
print players
运行结果如下:
['charles', 'martina', 'michael', 'florence']
2. remove():按元素删除,括号中加入要删除的元素
players = ['charles','martina','michael','florence','eli']
players.remove('charles')
print players
运行结果如下:
['martina', 'michael', 'florence', 'eli']
3. del:按下标删除
players = ['charles','martina','michael','florence','eli']
del players[0]
print players
运行结果如下:
['martina', 'michael', 'florence', 'eli']