import os
s = os.sys.stdin.buffer.read(1024*32)
失败了
D:\Projects\pytools>python t1.py
Traceback (most recent call last):
File "t1.py", line 2, in <module>
s = os.sys.stdin.buffer.read(1024*32)
OSError: [Errno 12] Not enough space
buf 如果给定 buflen = 1024*32-1 则正确
import os
s = os.sys.stdin.buffer.read(1024*32-1)
如果您运行 python t1.py,那么进程会阻塞并按预期等待输入。为什么 python3.3 有 1024*32-1 的缓冲区长度限制?是系统不同,还是所有系统都一样?我们怎样才能消除这个限制?
顺便说一句:我使用 Windows 7 python 32 位版本 3.3