gpt4 book ai didi

python - python中的缓冲区是什么意思

转载 作者:太空狗 更新时间:2023-10-30 01:17:20 24 4
gpt4 key购买 nike

在 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 中是一个二进制字符串 (bytes),或者用 buffer 构造的对象.

关于python - python中的缓冲区是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5456730/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com