I have this piece of code
f = open('textfile.txt', 'r')
for line in f:
print line
lets just say the textfile.txt is something like this
1
2
3
4
5
How does this work? How does it know where it is in the file? I understand that it is printing over and over but why doesn't it just print the whole file over and over. I don't see how f is a range. I also assume it knows to stop at EOF?