[Tutor] Sort a Set

Jonas Melian jonasmg at SoftHome.net
Tue Aug 23 15:25:17 CEST 2005


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[0] for x in cardTmp]

or:

from itertools import imap
for i in imap(lambda x: x[0], 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



More information about the Tutor mailing list