How can I remove all instances of an element from a list in Python?

list, python

Solution

If you want to modify the list in-place,

a[:] = [x for x in a if x != [1, 1]]

Problem

Lets say I have a list `a`: ``` a = [[1, 1], [2, 2], [1, 1], [3, 3], [1, 1]] ``` Is there a function that removes all instances of `[1, 1]`?

Original source

Related problems