n=input(“请输入一个数”)
try:
n=input(n)
m=100/n
print(m)
except ValueError:
print(“valueError 错误值”)
except ZeroDivisionError:
print(“ZeroDivisionError 分母为0”)
except Exception as resut:
print(“未知错误 %s”%resut)
else:
print(“尝试成功执行这里,ok”)
finally:
print(“不管异常是否发生,这里一定运行”)
python异常
最新推荐文章于 2024-05-06 10:00:00 发布