• <small id='uCq4h'></small><noframes id='uCq4h'>

      • <bdo id='uCq4h'></bdo><ul id='uCq4h'></ul>

        <i id='uCq4h'><tr id='uCq4h'><dt id='uCq4h'><q id='uCq4h'><span id='uCq4h'><b id='uCq4h'><form id='uCq4h'><ins id='uCq4h'></ins><ul id='uCq4h'></ul><sub id='uCq4h'></sub></form><legend id='uCq4h'></legend><bdo id='uCq4h'><pre id='uCq4h'><center id='uCq4h'></center></pre></bdo></b><th id='uCq4h'></th></span></q></dt></tr></i><div id='uCq4h'><tfoot id='uCq4h'></tfoot><dl id='uCq4h'><fieldset id='uCq4h'></fieldset></dl></div>
        <legend id='uCq4h'><style id='uCq4h'><dir id='uCq4h'><q id='uCq4h'></q></dir></style></legend>
        <tfoot id='uCq4h'></tfoot>

        Python 3:读取一行时的 EOF(Sublime Text 2 很生气)

        时间:2024-04-21

          <tfoot id='1rOPE'></tfoot>

              <tbody id='1rOPE'></tbody>
            1. <legend id='1rOPE'><style id='1rOPE'><dir id='1rOPE'><q id='1rOPE'></q></dir></style></legend>
            2. <small id='1rOPE'></small><noframes id='1rOPE'>

                <bdo id='1rOPE'></bdo><ul id='1rOPE'></ul>
                  <i id='1rOPE'><tr id='1rOPE'><dt id='1rOPE'><q id='1rOPE'><span id='1rOPE'><b id='1rOPE'><form id='1rOPE'><ins id='1rOPE'></ins><ul id='1rOPE'></ul><sub id='1rOPE'></sub></form><legend id='1rOPE'></legend><bdo id='1rOPE'><pre id='1rOPE'><center id='1rOPE'></center></pre></bdo></b><th id='1rOPE'></th></span></q></dt></tr></i><div id='1rOPE'><tfoot id='1rOPE'></tfoot><dl id='1rOPE'><fieldset id='1rOPE'></fieldset></dl></div>
                  本文介绍了Python 3:读取一行时的 EOF(Sublime Text 2 很生气)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当真时:回复 = input('输入文本')如果回复 == '停止':休息打印(回复.上())

                  结果是:

                  <块引用>

                  输入文本:Traceback(最后一次调用):<module> 中的文件C:PythonProjects5.py",第 2 行回复 = input('输入文本:')EOFError:读取一行时出现EOF[在0.2s内完成,退出代码为1]

                  它只在 Sublime Text 2 中.我试过 IDLE,试过命令行,一切都很完美.Subleme 为什么要冲我大喊大叫?

                  顺便说一句,也许你也可以解释一下在这种情况下 EOF 可能意味着什么.当然,我已经阅读了文档,如果从输入中读取 EOF,则会引发相应的错误.我想模拟这种情况.输入仅与键盘有关吗?如果是,我应该输入什么组合键来获得 EOF?

                  提前谢谢你.

                  解决方案

                  我也遇到了同样的问题.Sublime Text 默认控制台的问题是它不支持输入.

                  要解决这个问题,你必须安装一个名为 SublimeREPL 的包.SublimeREPL 提供了一个接受输入的 Python 解释器.

                  有一篇文章解释了详细解决方案.

                  SublimeREPL 的 GitHub 页面

                  while True:
                      reply = input('Enter text')
                      if reply == 'stop': break
                      print(reply.upper())
                  

                  The result was:

                  Enter text:Traceback (most recent call last):
                    File "C:PythonProjects5.py", line 2, in <module>
                      reply = input('Enter text:')
                  EOFError: EOF when reading a line
                  [Finished in 0.2s with exit code 1]
                  

                  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.

                  GitHub page for SublimeREPL

                  这篇关于Python 3:读取一行时的 EOF(Sublime Text 2 很生气)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:移动平均线 pandas 下一篇:map 函数返回的列表在使用一次后消失

                  相关文章

                  1. <tfoot id='nCzAW'></tfoot>
                    1. <small id='nCzAW'></small><noframes id='nCzAW'>

                        <bdo id='nCzAW'></bdo><ul id='nCzAW'></ul>

                      <legend id='nCzAW'><style id='nCzAW'><dir id='nCzAW'><q id='nCzAW'></q></dir></style></legend>

                      <i id='nCzAW'><tr id='nCzAW'><dt id='nCzAW'><q id='nCzAW'><span id='nCzAW'><b id='nCzAW'><form id='nCzAW'><ins id='nCzAW'></ins><ul id='nCzAW'></ul><sub id='nCzAW'></sub></form><legend id='nCzAW'></legend><bdo id='nCzAW'><pre id='nCzAW'><center id='nCzAW'></center></pre></bdo></b><th id='nCzAW'></th></span></q></dt></tr></i><div id='nCzAW'><tfoot id='nCzAW'></tfoot><dl id='nCzAW'><fieldset id='nCzAW'></fieldset></dl></div>