Re: noob stuck on reading double

2008-01-29 Thread John Machin
[I can't see Hannah's posting(s) with my news client (Thunderbird), nor with Google Groups] Joe Riopel wrote: > Since you're unpacking it with the 'd' format character I am assuming > a "doubleword" field is a double. Given Hannah has sensibly stated up front that she is a noob, I would assume

Re: noob stuck on reading double

2008-01-29 Thread Joe Riopel
Since you're unpacking it with the 'd' format character I am assuming a "doubleword" field is a double. You said you had 113 of them in the binary file. You should be doing something like this: file = open('data.bin', 'rb') file.seek(0) raw = file.re

Re: noob stuck on reading double

2008-01-29 Thread Joe Riopel
On Jan 29, 2008 1:35 PM, Hannah Drayson <[EMAIL PROTECTED]> wrote: > It imports as a string of rubbish... > i.e. > > > >>> text = f.read() > >>> print text > ?F?C??y??>? > @[EMAIL PROTECTED]@???/???8[EMAIL PROTECTED]/[EMAIL > PROTECTED]@?Q???Q???Q???Q???Q??ǑR[???Q?

Re: noob stuck on reading double

2008-01-29 Thread Joe Riopel
On Jan 29, 2008 1:59 PM, Joe Riopel <[EMAIL PROTECTED]> wrote: > When reading the file, try using > file = open('data.bin', 'rb') > file.seek(0) > raw = file.read() > > Do the unpack on "raw". Ignore this, sorry for the confusion. -- http://mail.python.org/mailman/listinfo/python-list

noob stuck on reading double

2008-01-29 Thread Hannah Drayson
Hi all, I have a .bin file which python just won't play ball with- Does anyone know what I'm doing wrong- is it simply incompatible? I've read it fine using a C program - its 113 doubleword fields- apparently its possible to handle these in python in a very similar way to C. I can provide the c