2.27 异常
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
def except_function():
try:
# 故意除零
10 / 0
except:
print ("发生某种异常啦.")
else:
# 正常情况.
print ("一切正常啦.")
pass
finally:
# 无论是否发生异常都将执行最后的代码
print ("finally必须被执行,不管有没有发生异常.")