En Tue, 05 Feb 2008 11:50:25 -0200, Mastastealth <[EMAIL PROTECTED]>
escribi�:
> On Feb 5, 1:17 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
>> Using the struct module http://docs.python.org/lib/module-struct.html
>>
>> import struct
>> data = info.read(15)
>> str1, str2, blank, height, wid
On Feb 5, 8:50 am, Mastastealth <[EMAIL PROTECTED]> wrote:
> What is this value for? "6s3s1cBBBh" and why is my unpack limited to a
> length of "16"?
>
> Unfortunately it seems my understanding of binary is way too basic for
> what I'm dealing with. Can you point me to a simple guide to
> explainin
On Feb 5, 1:17 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> Using the struct module http://docs.python.org/lib/module-struct.html
>
> import struct
> data = info.read(15)
> str1, str2, blank, height, width, num2, num3 =
> struct.unpack("6s3s1cBBBh", data)
>
> Consider this like a "first atte
On 5 feb, 01:51, Mastastealth <[EMAIL PROTECTED]> wrote:
> I'm trying to create a program to read a certain binary format. I have
> the format's spec which goes something like:
>
> First 6 bytes: String
> Next 4 bytes: 3 digit number and a blank byte
> ---
> Next byte: Height (Number up to 255)
> N
You should look into the struct module. For example, you could do the same
thing via (using the variable names you used before):
header_str = info.read(13)
a,b,c,d,e = struct.unpack("6s4sBBB", header_str)
After that, you will probably be able to get the integers by (doing it one
at a time... read'