I have a list of lists and I'd like to remove all nested lists which contain any of multiple values.
list_of_lists = [[1,2], [3,4], [5,6]]
indices = [i for i,val in enumerate(list_of_lists) if (1,6) in val]
print(indices)
[0]
I'd like a lists of indices where this conditions is so that I can:
del list_of_lists[indices]
To remove all nested lists which contain certain values. I'm guessing the problem is where I try to check against multiple values (1,6)
as using either 1
or 6
works.