我正在學習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