我在
运行sys.stdin.fileno()
时出现错误
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
sys.stdin.fileno()
io.UnsupportedOperation: fileno
看起来您正在空闲运行;IDLE 维护自己的伪终端,并且该伪终端实际上并不基于"真实"文件(存在内核文件描述符的东西(。因此,它没有fileno
可得到;如果您希望fileno
工作,请使用普通外壳,而不是 IDE 外壳。