当我只使用一台服务器进行测试时,我得到了错误。= sum of servers divided by number of used servers return sum_ / len(temp.keys()) print("error")in calc_average return sum_ / len(temp.keys())
ZeroDivisionError:被零
脚本中的某个错误消息当前正在try以外块中捕获。对于预期的用途,这会让错误发生得太频繁,我想知道是否有一种整洁的方法从一个错误中创建一个子类,该方法可以计算在触发之前发生了多少次。0.166666666666666660.11.0
ZeroDivisionError1 from random import randint
2 for i i