b6582459
b6582459

Reputation: 31

Skipping data in a binary file in Python

I'm writing a file reader for my (binary) format and I sometimes need to skip some portion of the file.

I could do fileobject.read(howmuchtoskip) for that, but I guess that will load the unneeded part to memory and will be slow.

Can I just set the "index" of the "pointer" or whatever that's called?

Upvotes: 1

Views: 655

Answers (1)

Dan D.
Dan D.

Reputation: 74655

Use fileobject.seek(offset).

Upvotes: 7

Related Questions