delete duplicates in list
Diez B. Roggisch
deets_noospaam at web.de
Wed Oct 29 22:07:23 CET 2003
> this must have come up before, so i am already sorry for asking but a
> quick googling did not give me any answer.
> i have a list from which i want a simpler list without the duplicates
> an easy but somehow contrived solution would be
In python 2.3, this should work:
l = [1,2,2,3]
s = sets.Set(l)
A set is a container for which the invariant that no object is in it twice
holds. So it suits your needs.
More information about the Python-list