Reputation: 49
I have this list
lst = [ [2,0,1], [0,0,0], [3,2,4], [0,0,0,0] ]
I'm looking for a way to remove those lists that only have numbers 0
So the expected output is:
lst = [ [2,0,1], [3,2,4] ]
Upvotes: 0
Views: 135
Reputation: 191864
Try this list comprehension
[l for l in lst if not all(x == 0 for x in l)]
Upvotes: 0