【发布时间】:2021-04-07 19:10:46
【问题描述】:
在 Windows 上,交互式 Python sys.stdin.readline() 将 Ctrl+V 粘贴截断为 512 个字符。
如何扩展此限制?我需要用于原型制作的大浆料。
尝试了fdopen() 技巧,但没有奏效。
缓冲区在 macOS 上似乎是 1024。
UPD:看起来缓冲区大小是compile-time constant。
在C语言中,可以用setvbuf()扩展缓冲区,但是这个函数没有被Python包裹,这很遗憾。我想我会尝试在MSVCRT.DLL 和ctypes 中调用它。
【问题讨论】:
标签: python python-3.x windows stdin