converting a float to bytearray or int
https://stackoverflow.com/questions/36893206/converting-a-float-to-bytearray/36894176
>>> value = 3.5e-43 >>> ba = bytearray(struct.pack("f", value)) >>> print([ "0x%02x" % b for b in ba ]) ['0xfa', '0x00', '0x00', '0x00']
0xfa is actually 250
浙公网安备 33010602011771号