- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我必须解决 codechef 中的给定任务。提交代码后,我收到一条错误消息“EOFError”。这是什么意思以及如何解决? ----------
x=0
arr = list()
while (x!=42):
x= int(input("enter the number: "))
arr.append(x)
print(arr)
<小时/>
Traceback (most recent call last):
File "./prog.py", line 5, in <module>
EOFError: EOF when reading a line
<小时/>
这是我收到的错误消息。
最佳答案
我不确定这个问题,所以我猜测输入格式......
.
在这种情况下,我认为您正在输入一个整数列表,直到在列表中遇到 42...如果是这种情况,根据您的代码,它将在不同的行中读取 x...
.
我认为在这个问题中,元素列表是以空格分隔的 1 行给出的,而不是以单独的行给出的...这就是为什么它显示文件结尾,因为代码期望在 diff 行中输入更多输入,并且只有一行...
.
现在如果输入是这样的
输入:
4 6 7 43 54 42
arr=list(map(int,input().split()))
print(arr)
输出:
[4,6,7,43,54,42]
我认为这就是您的问题的情况,并且足以开始...如果您发现它有帮助,请投票:)
关于python - python 中的 "EOFError"是什么以及如何修复?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56956226/
从 Rails 控制台使用 MailChimp gem 时出现间歇性错误。 这是错误: Excon::Errors::SocketError: EOFError (EOFError) from /
我正在使用 tkinter 和 urllib 制作这个程序,它应该像一个下载管理器。在我几乎完成该程序后,我意识到我没有为下载定义取消按钮。在深入研究之后,我发现了多处理(在此之前我只是使用线程),显
当我尝试 chown 一个目录时,Fabric 给我一个 EOFError。只有当我从 fabric 之前运行的 python 脚本运行子进程时才会发生。 来 self 的 fabfile: ...
当我使用来自其他脚本的子进程启动我的 python3 脚本时,出现以下错误: Select the keyword preset you want to use:Traceback (most rec
编辑:我很蠢 对不起大家。我的循环不工作的原因是一个极其愚蠢的原因;我的 pickle.dump() 参数顺序错误。 操作 第一次 pickle 物体,抱歉,如果这是一个棘手的问题;看过各种其他 EO
我有一堆客户端通过 0MQ 连接到服务器。我有一个管理器队列,用于工作池与每台客户端计算机上的主进程进行通信。 在一台有 250 个工作进程的客户端机器上,我几乎立即看到一堆 EOFError。它们发
这可能会重复,但现有的答案都没有解决我的问题。 因此,我使用的是 Python 2.7,每当我尝试此操作时都会收到此错误(标题): number = int(raw_input('Number : '
这个问题在这里已经有了答案: Unable to install pygame on Python via pip (Windows 10) (6 个答案) 关闭 2 年前。 我正在使用 Windo
我正在尝试使用 pickle 为我的游戏创建一个保存文件,但是当我尝试提交我的字典,然后取回该信息时,它不起作用。 import pickle data = {'health':100, 'gold'
我读取了一个只包含一行的文件。但是,在循环结束之前我无法停止读取文件。即 python 不会抛出 EOFError 异常。我的代码有什么问题吗? for x in range(5): try:
我有一个简单的程序,我使用 pygame 导入声音,但它仍然是一个 CLI 程序。每当我将它编译成一个 exe 时,当我尝试运行它时它会给我一个 EOFError,它看起来像这样 Traceback
我最近发现了 pickle,这很神奇。但是当它用于我的实际脚本时,它对我来说是错误的,用一个单项字典测试它工作正常。我的真实脚本是数千行代码,其中存储了 Maya 中的各种对象。我不知道它是否与大小有
我有几个脚本在服务器上运行,可以对各种词典进行 pickle 和 unpickle。它们都使用相同的基本代码进行 pickle ,如下所示: SellerDict=open('/home/hostad
我有以下代码片段: def database(self): databasename="" host="" user="" password="" try:
我正在读取 CSV 作为 Spark DataFrame 并对其执行机器学习操作。我不断收到 Python 序列化 EOFError - 知道为什么吗?我认为这可能是一个内存问题——即文件超出了可用
当我运行下面的代码时,我收到此错误消息“EOFError: Ran out of input”这是什么意思??怎么才能矫正??以及如何在屏幕上输出记录的详细信息。 import pickle # th
为什么我在运行 django 服务器时会出现以下错误,我该如何解决? : EOFError: marshal data too short 细节 Performing system checks...
尝试创建用户时,我在生产中遇到此错误(我正在使用devise gem)。 EOFError (end of file reached): 我之前遇到此问题,这是由于我使用zoho mail的smtp设
我正在努力解决这一问题,我们将不胜感激! 我有两个Rails应用程序,我们称它们为Client and Service,它们都是非常简单的普通REST界面-这是基本方案: 客户端向服务发出POST/r
一切正常,直到: celery beat v3.1.18 (Cipater) is starting. __ - ... __ - _ Configuration ->
我是一名优秀的程序员,十分优秀!