我阅读了有关追溯错误的 Python 问题的答案,可惜我不理解所提供的答案。当我运行以下代码时,如果用户不输入任何内容,我会收到回溯错误。我怎样才能避免它?请只给出具体和简短的答案。谢谢!
Error: Python Traceback Error: Invalid Literal for int() with base 10
def gold_room():
print "This room is full of gold. How much do you take?"
next = (raw_input(">>> "))
how_much = int(next)
if how_much < 50:
print "Nice, you're not greedy, you win!"
exit(0)
elif how_much > 50:
print "You greedy bastard!"
exit(0)
else:
dead("Man, learn to type!")