Unique Elements in a List

Facundo Batista facundobatista at gmail.com
Sun May 15 12:09:16 EDT 2005


On 5/9/05, James Stroud <jstroud at mbi.ucla.edu> wrote:

> > Is there an easy way to grab the Unique elements from a list?

>>> from sets import Set as set
>>> data = [0.1,0.5,0.6,0.4,0.1,0.5,0.6,0.9]
>>> for x in set(data):
...     print x
...
0.5
0.9
0.6
0.4
0.1


.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/



More information about the Python-list mailing list