def chufa(a,b):
if b ==0:
raise Exception("除数不能为0")#抛出异常
def testAge(age):
if age <=18:
raise Exception("你的年龄不允许进入")
chufa (10,0)
print("打印第一行代码")
try:
testAge(16)
except Exception as e:
print(e)
print("打印第二行代码")
def chufa(a,b):
if b ==0:
raise Exception("除数不能为0")#抛出异常
def testAge(age):
if age <=18:
raise Exception("你的年龄不允许进入")
print("打印第一行代码")
try:
testAge(16)
except Exception as e:
print(e)
print("打印第二行代码")