You can use a counter for this task:
>>> from collections import Counter
>>> L = [(2,3),(2,3),(4,8)]
>>> [k for k,count in Counter(L).items() if count > 1]
[(2, 3)]
If you want all the cheats, not one of them, use a counter as well as a key.
If you care about the initial order, do the same, but use OrderedCounter:
>>> from collections import Counter, OrderedDict
>>> class OrderedCounter(Counter, OrderedDict):
... pass
source
share