I\'m trying to repeatedly go through a text file of a few lines. When my for loop is done with one pass through the file, I want to repeat the file from the beg
I gather that you want to go back to the start of the file and read it all again. The simplest way is
infile.seek(0)
A slower and somewhat more involved way is to close the file and reopen it.
When you read the file, a pointer is set to the end of the file. To go back to the beginning of the file you reset the pointer by doing "infile.seek(0)" If you want to go to the end of the file you pass 2 as the argument.