read only the last x bytes from a text file

Donn Cave donn at drizzle.com
Wed May 29 10:50:07 EDT 2002


On Wed, 29 May 2002 15:10:46 +0200, Felix Seeger wrote:
| I am writing a log monitor.
| It checks the filesize and the new filesize.
|
| Now I want only the difference between this vars.
| eg read the last 1000 bytes from the file.
|
| How can I do this ?

   file.seek(filesize, 0)
   result = file.read(new_filesize - filesize)

	Donn Cave, donn at drizzle.com



More information about the Python-list mailing list