I am reading a Hexadecimal binary file. I need to remove bytes after seek command to specific location. Below code is reading binary file. But i don't know how to remove 4 bytes in middle of file.
import os
import struct
with open("esears36_short.dat", "rb") as f:
data = f.read(2)
number = struct.unpack(">h", data)[0]
f.seek(number, 1)
#need to code to remove 4 bytes
I need to execute this code in loop until EOF. Remove 4 bytes after every n bytes specfied in number field.
Value of number field in this case : 28045
Please help!