If I have a bit of Python like:
n = [1, 3, 5, 1]
n.remove(1)
print n
n will return [3, 5, 1]
because .remove()
quits after it finds its first match. What could I do to return just [3, 5]
, having found all matches (or in this case, all the 1
s)?