OSError:[Errno 27]文件太大

时间:2018-06-28 19:59:13

标签: python python-3.x

我写了这段代码:

N=int(input())
a=0
b=1
print(a,end=" ")
print(b,end=" ")
while(1):
    c=a+b
    if (c==N):
        print(c)
        break
    else:
        print(c,end=" ")
        a,b=b,(a+b)

但是发生以下错误:

Traceback (most recent call last): File "Main.py", line 12, in
    print(c,end=" ")
OSError: [Errno 27] File too large
Command exited with non-zero status (1)

我是python的新手。问题是什么..??而我该如何解决这个问题... ??

1 个答案:

答案 0 :(得分:0)

在while循环中替换条件。您已经指定了一个条件,它可以无限次执行。尝试给出有效条件。