try语句
请问下try语句是怎么判断底数为1的错误对应的except的,明明后两个except都没有判断语句 因为当底数为 1 时 math.log() 会自动抛出 ZeroDivisionError 异常:>>> import math
>>> math.log(5, 1)
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
math.log(5, 1)
ZeroDivisionError: float division by zero zltzlt 发表于 2020-3-22 20:52
因为当底数为 1 时 math.log() 会自动抛出 ZeroDivisionError 异常:
感谢
页:
[1]