deduping
Thomas Lehmann
t.lehmann at rtsgroup.net
Mon Jun 21 09:12:01 EDT 2010
> universe={}
> for line in outf:
> if line.split(',')[1].strip() in universe.keys():
> a=1
> else:
> if line.split(',')[1].strip() in done_.keys():
> a=1
> else:
> universe[line.split(',')[1].strip()]=0
>
I can not say too much because I don't see what is processed
but what I can say is: "line.split(',')[1].strip()" might be
called three times so I would do it once only. And I would write
it like this:
for line in outf:
key = line.split(',')[1].strip()
if not (key in universe.keys()):
if not (key in done_.keys()):
universe[key] = 0
More information about the Python-list
mailing list