为什么我会收到 EOF 错误以及如何解决它?

问题描述 投票:0回答:1

我是一名初学者,目前正在通过“Python速成课程:第三版”学习Python,我刚刚开始第7章,其中涉及输入。每当我尝试使用输入时,我都会收到 EOF 错误。对于上下文,我正在使用 Visual Studio Code。

这是我在 Visual Studio Code 中输入的内容:

message = input("Tell me something, and I will repeat it back to you: ")
print(message)

事情是这样的:

Tell me something and i will repeat it back to you: 
Traceback (most recent call last):
  File "C:\Users\Andrew\Desktop\python_work\Chapter 7 python\parrot.py", line 1, in <module>
    message = input("Tell me something and i will repeat it back to you: ")
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
EOFError: EOF when reading a line
python visual-studio-code input eof
1个回答
0
投票

我想通了。这是因为很久以前,我通过将控制台从“integratedTerminal”更改为“internalConsole”来简化 launch.json 文件中的输出,这不允许用户输入。

© www.soinside.com 2019 - 2024. All rights reserved.