【Python】异常
异常
def execpt_test(a, b):
result = a / b
return result
def divide_numbers(a, b):
try:
execpt_test(a, b)
except ZeroDivisionError:
print("除数不能为零!")
print(divide_numbers(10, 0))
def execpt_test(a, b):
result = a / b
return result
def divide_numbers(a, b):
try:
execpt_test(a, b)
except ZeroDivisionError:
print("除数不能为零!")
print(divide_numbers(10, 0))