Re: stripping the first byte from a binary file

2007-07-11 Thread Alex Popescu
On Jul 11, 7:45 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Alex Popescu wrote: > > On Jul 11, 4:15 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> > Forgive my newbie ignorance, but I am wondering why the other method > >> > would not work? I mean it may not be very safe, > >> > but

Re: stripping the first byte from a binary file

2007-07-11 Thread Diez B. Roggisch
Alex Popescu wrote: > On Jul 11, 4:15 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> > Forgive my newbie ignorance, but I am wondering why the other method >> > would not work? I mean it may not be very safe, >> > but I guess it may perform a lot better, than having to read the whole >> > fi

Re: stripping the first byte from a binary file

2007-07-11 Thread Alex Popescu
On Jul 11, 4:15 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > Forgive my newbie ignorance, but I am wondering why the other method > > would not work? I mean it may not be very safe, > > but I guess it may perform a lot better, than having to read the whole > > file just to cut out the firs

Re: stripping the first byte from a binary file

2007-07-11 Thread Stefan Behnel
Alex Popescu wrote: > Forgive my newbie ignorance, but I am wondering why the other method > would not work? I mean it may not be very safe, > but I guess it may perform a lot better, than having to read the whole > file just to cut out the first byte. Why would you expect that? It *might* perform

Re: stripping the first byte from a binary file

2007-07-11 Thread Diez B. Roggisch
> > Forgive my newbie ignorance, but I am wondering why the other method > would not work? I mean it may not be very safe, > but I guess it may perform a lot better, than having to read the whole > file just to cut out the first byte. Because seeking is not moving? Shifting data bytewise isn't so

Re: stripping the first byte from a binary file

2007-07-11 Thread Alex Popescu
On Jul 11, 1:25 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > rvr wrote: > > On Jul 11, 1:28 pm, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: > >> On Wed, 11 Jul 2007 01:06:04 +, rvr wrote: > >>> Is there a way to edit the file in place? The best I seem to be able to > >>> do is to use your

Re: stripping the first byte from a binary file

2007-07-11 Thread Stefan Behnel
rvr wrote: > On Jul 11, 1:28 pm, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: >> On Wed, 11 Jul 2007 01:06:04 +, rvr wrote: >>> 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 fi

Re: stripping the first byte from a binary file

2007-07-11 Thread rvr
On Jul 11, 1:28 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 11 Jul 2007 01:06:04 +, rvr wrote: > > 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 a

Re: stripping the first byte from a binary file

2007-07-10 Thread Steven D'Aprano
On Wed, 11 Jul 2007 01:06:04 +, rvr wrote: > 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. I don't

Re: stripping the first byte from a binary file

2007-07-10 Thread rvr
On Jul 10, 6:37 pm, Jeremy Sanders 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.

Re: stripping the first byte from a binary file

2007-07-10 Thread Jeremy Sanders
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 res

stripping the first byte from a binary file

2007-07-10 Thread rvr
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. ~rvr -- http://mail.python.org/mailman/listinfo/python-list