How to convert a float to its binary or hex representation in Python?
Say I want to convert the float 5.0 to its binary equivilient, how do I do this? I mean, how do I get Python to tell me that 5.0 (single precision) is described in machine code as something like
0000 0000 0000 0000 0100 0000 1010 0000
or
0000 40a0
? Thanks for any thoughts.
Last edited by zero79; 08-29-2005 at 09:10 PM.
|