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. open file 'data.bin', mode 'rb' at 0x5a2a8 text = f.read() print text ?F?C??y??? @[EMAIL PROTECTED]@???/???8[EMAIL PROTECTED]/[EMAIL

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

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

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