I have two lists that contain many of the same items, including duplicate items. I want to check which items in the first list are not in the second list. For example, I mig
Create Counters for both lists, then subtract one from the other.
subtract
from collections import Counter a = [1,2,3,1,2] b = [1,2,3,1] c = Counter(a) c.subtract(Counter(b))