list_x
, list_y
, list_y
, , , . -
list_x=[(1,1),(1,2),(2,3),(2,5),(4,6), ...]
list_y=[(1,1,33),(1,3,65),(2,4,11), ...]
list_x_set = set(list_x)
result = [item for item in list_y if item[0:2] not in list_x_set]
-
In [57]: list_x=[(1,1),(1,2),(2,3),(2,5),(4,6)]
In [58]: list_y=[(1,1,33),(1,3,65),(2,4,11)]
In [59]: list_x_set = set(list_x)
In [60]: result = [item for item in list_y if item[0:2] not in list_x_set]
In [62]: result
Out[62]: [(1, 3, 65), (2, 4, 11)]