On Jul 10, 6:37 pm, Jeremy Sanders <jeremy
[EMAIL PROTECTED]> wrote:
> 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')
> f.read(1)  # read 1st byte and ignore it
> rest = f.read()  # read rest
>
> or
>
> data = f.read()
> data = data[1:] # skip 1st byte

Is there a way to edit the file in place? The best I seem to be able
to do is to use your second solution to read the file into the string,
then re-open the file for writing and put the whole thing back (minus
the first byte). Thanks.

~rvr

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to