In Python I need to convert a bunch of floats into hexadecimal. It needs to be zero padded (for instance, 0x00000010 instead of 0x10). Just like http://gregstoll.dyndns.org/
Further to Jonathon Reinhart's very helpful answer. I needed this to send a floating point number as bytes over UDP
import struct # define double_to_hex (or float_to_hex) def double_to_hex(f): return hex(struct.unpack('d', doubleAsBytes)[0] # or '>f' for float_to_hex
d', doubleAsBytes)[0] # or '>f' for float_to_hex