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
Counters are new in Python 2.7. For a general solution to substract a from b:
def list_difference(b, a): c = list(b) for item in a: try: c.remove(item) except ValueError: pass #or maybe you want to keep a values here return c