标签:input put exce else bsp -- 异常 使用 one
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‘)
标签:input put exce else bsp -- 异常 使用 one
原文地址:http://www.cnblogs.com/huangjinshan/p/6236724.html