#coding=utf-8 from struct import pack,unpack byte=pack('f',1.5) print(byte) print([i for i in byte]) byte=pack('f',123432.523424) print(byte) print([i for i in byte])
输出
?? ['\x00', '\x00', '\xc0', '?'] C?G ['C', '\x14', '\xf1', 'G']
#coding=utf-8 from struct import pack,unpack byte=pack('f',1.5) print(byte) print([i for i in byte]) byte=pack('f',123432.523424) print(byte) print([i for i in byte])
输出
?? ['\x00', '\x00', '\xc0', '?'] C?G ['C', '\x14', '\xf1', 'G']