Help need with converting Hex string to IEEE format float

Ian Vincent i_vincent at hotmail.com
Fri Dec 17 06:15:52 EST 2004


Max M <maxm at mxm.dk> wrote in news:41bf121e$0$280
$edfadb0f at dread12.news.tele.dk:
> 
> ##
> st = '80 00 00 00'
> 
> import binascii
> import struct
> 
> s = ''.join([binascii.a2b_hex(s) for s in st.split()])
> v = struct.unpack("f", s)[0]
> print v
> ##

This one worked great for what I was trying to do.

Thanks to everybody for your help.

TTFN

Ian



More information about the Python-list mailing list