[Tutor] Sort a Set
Hugo González Monteverde
hugonz-lists at h-lab.net
Tue Aug 23 21:53:38 CEST 2005
undup = 
for i in list:
if i not in undup:
Which is simple an not very pythonic, but does the trick.
Jonas Melian wrote:
> I get a list of repeated numbers [24, 24, 24, 16, 16, 15, 15 ]
> Is possible get it without repeated numbers, without using set()?
> If I use set, then the list is unsorted and i cann't sorting it.
> For get the values i use:
> [x for x in cardTmp]
> from itertools import imap
> for i in imap(lambda x: x, cardTmp): print i
> A idea it would be create a generator that will return elements one by
> one, and then it would be possible know if that element is in the new
> list. But generators are in 2.4
> Python 2.3.5
> Tutor maillist - Tutor at python.org
More information about the Tutor