python 获取数字在内存的内容

时间:2022-05-24 02:20:54

 

#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']