Best way to make a list unique?

Batista, Facundo FBatista at uniFON.com.ar
Tue Mar 8 14:02:43 CET 2005


[Max M]

#-  >>> la = [1,2,3,4,3,2,3,4,5]
#-  >>> from sets import Set
#-  >>> sa = Set(la)
#-  >>> for itm in sa:
#- ...     print itm

Remember that in Python 2.4 you have ´´set´´ as a built-in data type:

>>> la = [1,2,3,4,3,2,3,4,5]
>>> sa = set(la)
>>> for it in sa:
	print it
	
1
2
3
4
5


.    Facundo

Bitácora De Vuelo: http://www.taniquetil.com.ar/plog
PyAr - Python Argentina: http://pyar.decode.com.ar/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20050308/59ec6418/attachment.html>


More information about the Python-list mailing list