"Robert Hicks" <[EMAIL PROTECTED]> wrote 
> This is the loop code:
> 
> for line in f2:
>     for id in idList:
>         if id in line:
>             print "%s: %s" % (id, f2.next())
>             found = "%s: %s" % (id, f2.next())
>             f3.write(found)
> 

While I note that you got a solution using regex one general 
point worth noting is that you should, in nested loop cases like 
this, at least use break in the inner loop.

Here you search the line for each id - 129 searches, even 
if you find it first time. Thus adding a break inside the if block 
should save, on average 60 if tests. And given each test 
involves iterating over the line thats significant!

Alan G.
(Whos been away for a week)

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to