raise抛出异常 #raise抛出异常 def fun(): for i in range(5): if i > 1: raise Exception("数字大于1") except Exception as ret: print(ret) fun()