For example
list_of_specific_element = [2,13]
list = [[1, 0], [2, 1], [2, 3], [13, 12], [13, 14], [15, 13]]
I want the sublist including any value inside the list of specific element be removed from the list.
So the element [2,1],[2,3],[13,12],[13,14]
should be removed from the list.
the final output list should be[[1,0],[15,13]]
listy=[elem for elem in listy if (elem[0] not in list_of_specific_element) and (elem[1] not in list_of_specific_element)]
Using list comprehension one-liner
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With