加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python中的缓冲区意味着什么

发布时间:2020-12-16 22:19:16 所属栏目:Python 来源:网络整理
导读:在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

在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构造的对象.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读