我正在学习python,当运行这个简单的猜测程序时,我得到一个错误guess = int(input('Enter an integer:'))因为本书基于在这个版本上。提前致谢!非常简单的Python应用程序中的输入错误
number = 23
running = True
while running:
guess = int(input('Enter an integer: '))
if guess == number:
print('Congratulations')
running = False
elif guess < number:
print('No higher!')
else:
print('Little lower!')
else:
print('while loop is over.')
print('done')
错误:
Enter an integer: Traceback (most recent call last):
File "../Documents/Python Programs/while.py", line 5, in <module>
guess = int(input('Enter an integer: '))
EOFError: EOF when reading a line
[Finished in 0.1s with exit code 1]
请修复您的缩进。你还在哪里运行这个程序? Sublime2? – jamylak 2013-04-22 05:52:47
[Python 3不能与Sublime Text 2一起使用]的可能重复(http://stackoverflow.com/questions/13059062/python-3-is-not-working-with-sublime-text-2) – jamylak 2013-04-22 05:54:40
@jamylak是崇高2和哎呀,这是一个副本和浪费的错误,主题中的行缩进,虽然 – 2013-04-22 05:55:51