在struct的python文档中,使用了单词buffer而没有解释:
http://docs.python.org/library/struct.html
struct.unpack_from(fmt,buffer[,offset=0])
Unpack the buffer
according to the given format. The
result is a tuple even if it contains
exactly one item. The buffer must
contain at least the amount of data
required by the format
(len(buffer[offset:]) must be at least
calcsize(fmt)).
最佳答案
它是一个内存缓冲区:在Python 2中,一个字符串(str),在Python 3中,一个二进制字符串(字节),或者一个用
buffer
构造的对象.