I read the file in Python one at a time, and I need to know which line is the last one when reading, something like this:
f = open("myfile.txt") for line in f: if line is lastline:
From the examples, I found that it includes searching and fully reading files to count lines, etc. Can I only notice that the current line is the last? I tried to go and check for the existence of "\ n", but in many cases the last lines should not be followed by a backslash N.
Sorry if my question is superfluous as I did not find an answer to SO
source share