简体   繁体   中英

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?

Use fileobject.seek(offset) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM