struct — Interpret bytes as packed binary data — Python 3.11.0 documentation
def float2bytes(f, BigEndian=True):
if BigEndian:
return [hex(i) for i in struct.pack('>f', f)]
else:
return [hex(i) for i in struct.pack('<f', f)]
struct — Interpret bytes as packed binary data — Python 3.11.0 documentation
def float2bytes(f, BigEndian=True):
if BigEndian:
return [hex(i) for i in struct.pack('>f', f)]
else:
return [hex(i) for i in struct.pack('<f', f)]