简单示例
import math
for i in range(10):
try:
input_number = input('write a number')
if(input_number == 'q'):
break
result = math.log(float(input_number))
print(result)
except ValueError:
print ('ValueError:input must > 0')
挡在wirte a number后面的文本框 输入一个除了q 的非数字时,提醒:
ValueError:input must > 0