Input 使用输入Python 3时出现EOF错误

Input 使用输入Python 3时出现EOF错误,input,pycharm,eof,Input,Pycharm,Eof,我不断收到EOF错误,但不确定原因。我试过使用int()和不使用int()但没有区别。我正在使用Pycharm 3.4和Python 3 谢谢, 克里斯 您必须关闭,因为您正在声明可能存在错误,并且希望对其进行处理 while True: try: number = int(input("what's your favourite number?")) print(number) break except ValueError as

我不断收到EOF错误,但不确定原因。我试过使用int()和不使用int()但没有区别。我正在使用Pycharm 3.4和Python 3

谢谢, 克里斯

您必须关闭,因为您正在声明可能存在错误,并且希望对其进行处理

while True:
    try:
        number = int(input("what's your favourite number?"))
        print(number)
        break
    except ValueError as e:
        print("Woah, there is an error: {0}".format(e))
while True:
    try:
        number = int(input("what's your favourite number?"))
        print(number)
        break
    except ValueError as e:
        print("Woah, there is an error: {0}".format(e))