On Jan 7, 6:47 pm, Corey Richardson <kb1...@aim.com> wrote: > On 01/07/2011 09:42 PM, John wrote: > > >>>> q_file = open(questions_location) #opens the document successfully > >>>> for line in q_file: > > print line > > > # prints document successfully > >>>> line > > # prints last line of document > >>>> for line in q_file: > > print line # prints nothing > > > ...why does it print nothing? > > IIRC, iterating through the lines in a file moves the cursor (is that > the correct term?) to the end of the file. After the first one, use > q_file.seek(0) to go back to the start. I think. > > ~Corey Richardson
fantastic. thanks, corey! -- http://mail.python.org/mailman/listinfo/python-list