Thanks for your response.
I guess the documentation on the p format wasn't clear to me ... or
perhaps I was just hoping to much for an easy solution !
The data is part of a record structure that is written to a file with
a few "int"'s and "longs" mixed in. The pattern repeats through the
file wi
Peter Hansen wrote:
I would be inclined to say that the "p" format in struct (using
Python 2.4rc1 or Python 2.3.3) does not act as documented on
Windows XP SP2, at least...
I hope we've both just missed something obvious.
Okay, we were certainly missing something, but I don't believe
I would call i
Geoffrey wrote:
As I mentioned, I can parse the string and read it with multiple
statements, I am just looking for a more efficient solution.
This looks like about the best you can do, using the information
from Tim's reply:
>>> buf = '\0\0\xb9\x02\x13EXCLUDE_CREDIT_CARD'
>>> import struct
>>> x =
Geoffrey wrote:
I am trying to read data from a file binary file and then unpack the
data into python variables. Some of the data is store like this;
...
As I read the documentation the "p" format string seems to address
this situation, where the number bytes of the string to read is the
first byt
[Geoffrey <[EMAIL PROTECTED]>]
> I am trying to read data from a file binary file and then unpack the
> data into python variables. Some of the data is store like this;
>
> xbuffer: '\x00\x00\xb9\x02\x13EXCLUDE_CREDIT_CARD'
> # the above was printed using repr(xbuffer).
> # Note that int(0x13) =