Alex Martelli a écrit :

Jean-Baptiste PERIN <[EMAIL PROTECTED]> wrote:


I read 4 bytes from a binary file.

These bytes represent a floating point number (mantisse exponent form)

How can I get a float from these bytes ?


See the docs for module struct, specifically the struct.unpack function,
if the float is in the binary format your machine expects (or possibly
that but with the wrong endianity).  If the float's binary format is
different from what your machine uses, you're in for a lot of painful
bit-twiddling.


Alex

I'll have to handle Intel-PC, DEC-VAX and MIPS-SUN/SGI numbers So I can't escape the painful bit-twiddling

Anyway, struct.unpack will undoubtedly be an incredibly valuable help

thank you very very very much ..

JiBé
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to