Python struct.unpack字节长度问题
我有以下代码:Python struct.unpack字节长度问题,python,python-3.x,struct,byte,endianness,Python,Python 3.x,Struct,Byte,Endianness,我有以下代码: msg = b'0,[\x00\x01\x86\xec\x96N' print(struct.unpack("<"+"I",msg)) msg=b'0,[\x00\x01\x86\xec\x96N' print(struct.unpack)(“struct.unpack要求使用的缓冲区长度正好是格式的大小。[1] 改为使用struct.unpack\u from,这要求使用的缓冲区长度至少与格式大小相同。[2] msg=b'0,[\
msg = b'0,[\x00\x01\x86\xec\x96N'
print(struct.unpack("<"+"I",msg))
msg=b'0,[\x00\x01\x86\xec\x96N'
print(struct.unpack)(“struct.unpack
要求使用的缓冲区长度正好是格式的大小。[1]
改为使用struct.unpack\u from
,这要求使用的缓冲区长度至少与格式大小相同。[2]
msg=b'0,[\x00\x01\x86\xec\x96N'
>>>导入结构
>>>打印(结构解包(“
times = int(len(msg)/4)
struct.unpack("<"+"I" * times,msg)