data conversion question (binary string to 'real string')

Alexander Eisenhuth stacom at stacom-software.de
Fri Jul 25 08:57:57 EDT 2003


Hallo all there,

maby I don't see the forest because of all that trees, but :

from struct import *


# how can I convert
f = float(0.5)

# with
bin_str =  pack('!f', 0.5)

# now bin_str is '?\x00\x00\x00'


# to "3F000000" ?????


Thanks a lot for any help





More information about the Python-list mailing list