This list is full of people ready to help, I thank you all for the
time you have taken to reply.
Danny now I see where readline could cause headaches,.
Liam thanks for the examples they work great. The endianess will
always be in Big Endian (Motorola type) for this format.
I see why I should be
>
> You mentioned earlier that you're expecting an integer, an integer, and
> then a sequence of float. Don't count bytes if you can help it: let
> Python's struct.calcsize() do this for you.
>
>http://www.python.org/doc/lib/module-struct.html
>
> Your machine may align bytes differently than
On Tue, 10 Jan 2006, bill nieuwendorp wrote:
> I am trying to convert binary file to ascii
>
> here is the format spec
>
> steps = int 4
> value = int 4
> time = float 4 * steps
Hi Bill,
Ok, that structure seems fairly simple so far.
> >>> import struct
> >>> import string
> >>> f = file('b
On 11/01/06, bill nieuwendorp <[EMAIL PROTECTED]> wrote:
> time = struct.unpack(">steps+f",c)
> adding the f to tell structs it is in float format
>
> the string substitution
> seems like it would work but now I cant figure out how I would add the
> f on the end
Did you read up on string substitu
Hi John thanks for the tips
I had a bit of a typo in my first post
time = struct.unpack(">steps",c)
should read somthing more like
time = struct.unpack(">steps+f",c)
adding the f to tell structs it is in float format
the string substitution
seems like it would work but now I cant figure out h
On 11/01/06, bill nieuwendorp <[EMAIL PROTECTED]> wrote:
Hi Bill,
Some comments ---
> >>> import struct
> >>> import string
> >>> f = file('binary_file','rb')
> >>> line = f.readline()
> >>> L = tuple(line)
You can do slicing (things like L[:4]) on strings as well as on lists
and tuples. So th