Removing duplicates from a list

drochom drochom at googlemail.com
Thu Sep 15 10:06:45 EDT 2005


Rubinho napisal(a):
> I've a list with duplicate members and I need to make each entry
> unique.
>

hi,

other possibility (my newest discovery:) )

>>> a = [1,2,2,4,2,1,3,4]
>>> unique = d.fromkeys(a).keys()
>>> unique
[1, 2, 3, 4]

regards
przemek




More information about the Python-list mailing list