stripping the first byte from a binary file

Jeremy Sanders jeremy+complangpython at
Tue Jul 10 12:37:02 CEST 2007

rvr wrote:

> Would someone mind showing me how to strip the first byte from a
> binary file? For some reason I can't figure this out from the binary
> file editing examples I've read. Thanks.

Do you mean something like this?

f = open('test.dat', 'rb')  # read 1st byte and ignore it
rest =  # read rest


data =
data = data[1:] # skip 1st byte


Jeremy Sanders

More information about the Python-list mailing list