J
J. Cliff Dyer
No, you can't. The second loop prints nothing!Also note that you can iterate over a file several times:
f = open('foo.txt')
for line in f:
print line[0] # prints the first character of every line
for line in f:
print line[1] #prints the second character of every line
A file by default advances forward. Once you reach the end, you stay
there.
You are, of course, absolutely right. Sorry for the misinformation.