6
我在Python 3.3中有一个try-except块,我希望它无限期地运行。如何重复try-except块
try:
imp = int(input("Importance:\n\t1: High\n\t2: Normal\n\t3: Low"))
except ValueError:
imp = int(input("Please enter a number between 1 and 3:\n> ")
目前,如果用户输入一个非整数,将工作按计划进行,但如果他们要重新进入,它只是再次提高ValueError异常和崩溃。
解决此问题的最佳方法是什么?