How to read lines from end of a file?

Wm. King wjk at wjk.mv.com
Thu Dec 23 00:23:25 EST 1999


Just a newbie comment/question

Would another approach be to simply "import os"
use a UNIX command to 'tail -10 nameoflogfile'
then use ' os.popen(cmd).readlines()' in a for loop
or something like that rather than reading in a whole
file and reversing it to get the last few lines....

This approach works in shell scripting, so I thought
maybe this would work with Python as well...





More information about the Python-list mailing list