【发布时间】:2017-07-26 07:40:46
【问题描述】:
try:
grossCheck = int(input("How much? (figures only pls.)\n"))
except ValueError:
grossCheck = int(input("How much? (FIGURES ONLY PLS.)\n"))
tenPees = grossCheck * 0.1
realPees = grossCheck - tenPees
print("you've got " + str(realPees))
我明白了:
ValueError: invalid literal for int() with base 10: 'w'
During handling of the above exception, another exception occurred:
问题是我之前刚刚处理过同样的异常。 我正在尝试处理它,以防用户仍然多次输入错误的值而不破坏程序。
【问题讨论】:
-
你需要展示你的代码,以及完整的回溯。给定数据不足。
标签: python python-3.x exception-handling