>>> a=[1,2,3]
>>> a.remove(2)
>>> a
[1, 3]
>>> a=[1,2,3]
>>> del a[1]
>>> a
[1, 3]
>>> a= [1,2,3]
>
Since no-one else has mentioned it, note that del
(unlike pop
) allows the removal of a range of indexes because of list slicing:
>>> lst = [3, 2, 2, 1]
>>> del lst[1:]
>>> lst
[3]
This also allows avoidance of an IndexError
if the index is not in the list:
>>> lst = [3, 2, 2, 1]
>>> del lst[10:]
>>> lst
[3, 2, 2, 1]