try:#使用try与except异常和错误! age=input(‘>>>‘) #用户输入 int(age) num2 = input(‘>>>‘) int(num2) 1[1000] dic = {} dic=[‘name‘] except KeyboardInterrupt as e: print(e) except ValueError as e: print(e) except IndentationError as e: print(‘-------->‘,e) except TypeError as e: print(e) except Exception as e: print(e) else: print("try 内码错误没有异常执行我") finally: print(‘无论是否异常,都要执行我‘) print(‘11111111111111111‘)
时间: 2024-10-16 02:08:36