Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python struct.unpack字节长度问题_Python_Python 3.x_Struct_Byte_Endianness - Fatal编程技术网

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)