There are several ways to delete elements from a list. If you know the index of the element you want, you can use pop:
pop modifies the list and returns the element that was removed.
If you don’t need the removed value, you can use del operator:
If you know the element you want to remove (but not the index), you can use remove:
The return value from remove is None.
To remove more than one element, you can use del with a slice index:
As usual, the slice selects all elements up to, but not including, the second index.
from Thinking in Python
Deleting elements,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/ryansunyu/p/3841298.html