标签:name -- 不能 try bsp cep code one finally
try: print("-------") open(‘123.txt‘, ‘r‘) except (IOError, NameError): print("######") pass try: open(‘1.txt‘,‘r‘) except: print("异常") try: # open(‘1.txt‘, ‘r‘) print("1") except Exception as result: print("异常") print(result) else: print("没有异常") finally: print("finally") print("-----------------------") try: try: print(1/0) except ValueError as e: print(e) except ZeroDivisionError as e: print(e) print("-----------------------") try: try: 1 / 0 except ZeroDivisionError as e: print("无能为力,不能处理") raise except ZeroDivisionError as e: print(e)
标签:name -- 不能 try bsp cep code one finally
原文地址:https://www.cnblogs.com/sunBinary/p/10372412.html