I’m iterating through a file’s lines with enumerate()
, and sometimes would need to start the iterating at a specific file line, so I attempted testfile.seek()
, e.g. if I want to start iterating the file again at line 10 then testfile.seek(10)
:
test_file.seek(10)
for i, line in enumerate(test_file):
…
Yet the test_file
always keep iterating starting at the very first line 0.
What could I be doing wrong? Why isn’t the seek()
working? Any better implementations would be appreciated as well.
Thank you in advance and will be sure to upvote/accept answer