removing duplication from a huge list.
Chris Rebert
clp2 at rebertia.com
Fri Feb 27 00:15:39 EST 2009
On Thu, Feb 26, 2009 at 8:49 PM, Benjamin Peterson <benjamin at python.org> wrote:
> Shanmuga Rajan <m.shanmugarajan <at> gmail.com> writes:
>
>> f any one suggests better solution then i will be very happy.Advance thanks
> for any help.Shan
>
> Use a set.
To expand on that a bit:
counted_recs = set(rec[0] for rec in some_fun())
#or in Python 3.0:
counted_recs = {rec[0] for rec in some_fun()}
Cheers,
Chris
--
Follow the path of the Iguana...
http://rebertia.com
More information about the Python-list
mailing list