Python: EOFError: EOF when reading a line(Python:EOFError:读取一行时出现EOF)
问题描述
这可能会重复,但现有的答案都没有解决我的问题.
This may be repeated, but none of the existing answers solved my problem.
所以,我使用的是 Python 2.7
,每次尝试时都会收到此错误(标题):
So, I'm using Python 2.7
, and I get this error (title) whenever I try this:
number = int(raw_input('Number : '))
我在 Sublime Text 2、compileronline.com 和 codecademy 中尝试过这个;它在此站点的前 2 个中失败.它适用于 codecademy 和终端编译器,但我不明白它失败的确切原因.
I tried this in Sublime Text 2, compileronline.com and in codecademy; it fails in the first 2 of this sites. It works on codecademy and in the terminal compiler, but I can't understand exactly why it is failing.
推荐答案
这里的问题是Sublime text 2的控制台不支持输入.
要解决此问题,您可以安装一个名为 SublimeREPL 的软件包.SublimeREPL 提供了一个接受输入的 Python 解释器.
To fix this issue, you can install a package called SublimeREPL. SublimeREPL provides a Python interpreter that takes in input.
而对于compileronline.com,您需要在网站右下方的STDIN Input"字段中提供输入.
And as for compileronline.com, you need to provide input in the "STDIN Input" field on the lower right of the website.
这篇关于Python:EOFError:读取一行时出现EOF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Python:EOFError:读取一行时出现EOF


基础教程推荐
- 究竟什么是“容器"?在蟒蛇?(以及所有的 python 容器类型是什么?) 2022-01-01
- Kivy 使用 opencv.调整图像大小 2022-01-01
- 在 Django Admin 中使用内联 OneToOneField 2022-01-01
- 在 Python 中将货币解析为数字 2022-01-01
- Python,确定字符串是否应转换为 Int 或 Float 2022-01-01
- Python 中是否有任何支持将长字符串转储为块文字或折叠块的 yaml 库? 2022-01-01
- kivy 应用程序中的一个简单网页作为小部件 2022-01-01
- matplotlib 设置 yaxis 标签大小 2022-01-01
- 比较两个文本文件以找出差异并将它们输出到新的文本文件 2022-01-01
- 对多索引数据帧的列进行排序 2022-01-01