delete duplicates in list
Diez B. Roggisch
deets_noospaam at web.de
Wed Oct 29 16:07:23 EST 2003
Hi,
> 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:
import sets
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.
Regards,
Diez
More information about the Python-list
mailing list