#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])
输出
b'x00x00xc0?' [0, 0, 192, 63] b'Cx14xf1G' [67, 20, 241, 71]
#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])
输出
b'x00x00xc0?' [0, 0, 192, 63] b'Cx14xf1G' [67, 20, 241, 71]