我是一名初学者,目前正在通过“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
我想通了。这是因为很久以前,我通过将控制台从“integratedTerminal”更改为“internalConsole”来简化 launch.json 文件中的输出,这不允许用户输入。