Python - How can I open a file and specify the offset in bytes?

前端 未结 8 1670
我在风中等你
我在风中等你 2020-12-17 14:37

I\'m writing a program that will parse an Apache log file periodically to log it\'s visitors, bandwidth usage, etc..

The problem is, I don\'t want to open the log an

8条回答
  •  無奈伤痛
    2020-12-17 15:21

    You can manage the position in the file thanks to the seek and tell methods of the file class see https://docs.python.org/2/tutorial/inputoutput.html

    The tell method will tell you where to seek next time you open

提交回复
热议问题