问题描述
而True:
答复=输入('输入文本')
如果答复=='停止':中断
打印(reply.upper ())
结果是:
仅在Sublime Text 2中。我尝试了IDLE,尝试了命令行,一切都很完美。
Subleme为什么要对我大喊?当然,我已经阅读了文档,如果从输入中读取了EOF,则会引发相应的错误。我想为这种情况建模。输入仅关于键盘吗?如果是,我应该输入哪种键组合才能获得EOF?
谢谢。
我遇到了同样的问题。 Sublime Text默认控制台的问题在于它不支持输入。
要解决此问题,您必须安装一个名为SublimeREPL的软件包。 SublimeREPL提供了一个接受输入的Python解释器。
有一个详细说明了解决方案。
while True:
reply = input('Enter text')
if reply == 'stop': break
print(reply.upper())
The result was:
It is only in Sublime Text 2. I tried IDLE, tried command line, everything is perfect.Why should Subleme shout at me?
By the way, maybe you could also explain my what EOF may mean in such situation. Of course, I have read in the documentation, that if EOF is read from input, the appropriate error is raised. I would like to model this situation. Is input only about the keyboard? If yes, what combination of keys should I input to get EOF?
Thank you in advance.
I had the same problem. The problem with the Sublime Text's default console is that it does not support input.
To solve it, you have to install a package called SublimeREPL. SublimeREPL provides a Python interpreter which accepts input.
There is an article that explains the solution in detail.
这篇关于Python 3:读取行时EOF(Sublime Text 2生气)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!