Как вычесть 2 списка в Python
[item for item in x if item not in y]
Velvet Thunder
[item for item in x if item not in y]
# Example usage using list comprehension:
list_a = [1, 2, 3]
list_b = [1, 1, 1]
[a_i - b_i for a_i, b_i in zip(list_a, list_b)]
--> [0, 1, 2]
>>> z = list(set(x) - set(y))
>>> z
[0, 8, 2, 4, 6]