Efficiently finding the last line in a text file [duplicate]

Not the straight forward way, but probably much faster than a simple Python implementation:

line = subprocess.check_output(['tail', '-1', filename])

Leave a Comment