Possible Duplicate:
Get last n lines of a file with Python, similar to tail
Hello,
How can I have Python return the last n lines of a file without reading it line by line?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Something like this:
seek()to get something like the last 4096 bytes of a file.nor more, then you’re done. If you have fewer, then read the previous 4096 bytes until you’re done.Not sure if there’s a built-in way to do this.