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

前端 未结 8 1676
我在风中等你
我在风中等你 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:30

    If you're parsing your log line per line, you could juste save line number from the last parsing. You would juste have then to start read it from the good line the next time.

    Seeking is more usefull when you have to be in a very specific place in the file.

提交回复
热议问题