oplaTech About Teaching Archive
Oplatek's external memory

Remove duplicities in Python list- unique list


seen=set()
unique_formats=[x for x in formats if x not in seen and not seen.add(x)]


Find the duplicates

seen=set()
duplicates=[x for x in formats if x.name in seen or seen.add(x.name)]