try:
if(a>b):
raise Value_Error;
else:
print("no err");
except "Value_Error":
print("value error ...");
else:
print("a is smaller");
值错误未打印或raise语句未引发异常。有人可以通过制作“价值错误......”来帮助我打印
答案 0 :(得分:0)
修正:
try:
if a > b:
raise ValueError()
else:
print("no err")
except ValueError:
print("value error ...")
else:
print("a is smaller")