[Tutor] Problem with nested for-in (Alan Gauld)

emmanuel.delaborde emmanuel.delaborde at cimex.com
Thu Jan 29 14:55:13 CET 2009


>
> I suspect that you need to reset the reader iterator to the start.
> I'm sure there will be something in the iterator protocol to do
> that but failing that you would need to change the inner loop to:
>
> for line2 in csv.reader(open("CATEGORYLIST.csv","r"))
>
> which will re-read the file and create a new iterator each time...
> resetting the iterator would be faster I suspect.
>
> Alan G.
>
>


You are right, of course! It did the trick

Thank you

E.

-----------------------------------------------------------------------------------------------

This e-mail (and any attachments) is confidential and may contain 
personal views which are not the views of Cimex Media Ltd and 
any affiliated companies, unless specifically stated. It is intended 
for the use of the individual or group to whom it is addressed. If 
you have received it in error, please delete it from your system, 
do not use, copy or disclose the information in any way nor act in 
reliance on it and please notify postmaster at cimex.com

A company registered in England  Wales. Company Number 03765711
Registered Office : The Olde Bakehouse, 156 Watling Street East, Towcester,
Northants NN12 6DB

This email was scanned by Postini, the leading provider in Managed Email Security.



More information about the Tutor mailing list