Is it possible to get which values are duplicates in a list using python?
I have a list of items:
mylist = [20, 30, 25, 20]
I k
You should sort the list:
mylist.sort()
After this, iterate through it like this:
doubles = [] for i, elem in enumerate(mylist): if i != 0: if elem == old: doubles.append(elem) old = None continue old = elem