Python:EOFError:读取一行时出现EOF

2023-07-04Python开发问题
43

本文介绍了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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

在xarray中按单个维度的多个坐标分组
groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)...
2024-08-22 Python开发问题
15

Pandas中的GROUP BY AND SUM不丢失列
Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)...
2024-08-22 Python开发问题
17

GROUP BY+新列+基于条件的前一行抓取值
Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)...
2024-08-22 Python开发问题
18

PANDA中的Groupby算法和插值算法
Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)...
2024-08-22 Python开发问题
11

PANAS-基于列对行进行分组,并将NaN替换为非空值
Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)...
2024-08-22 Python开发问题
10

按10分钟间隔对 pandas 数据帧进行分组
Grouping pandas DataFrame by 10 minute intervals(按10分钟间隔对 pandas 数据帧进行分组)...
2024-08-22 Python开发问题
11