[Tutor] Problem iterating over csv.DictReader

Sander Sweers sander.sweers at gmail.com
Mon Apr 26 19:59:00 CEST 2010


On 26 April 2010 15:00, Matthew Williams <mhw at doctors.org.uk> wrote:
> What I'm looking for is a way to explicity reset the iterator, to tell it to
> go back to the beginning.

You will need to use the seek method on the fileobject.

f = open('insert your csv file here.csv', 'rb') #Note the b in 'rb'

#Do your processing

f.seek(0)

#Do some more

Greets
Sander


More information about the Tutor mailing list