1 s1 = 'hello'2 try:3 int(s1)4 except KeyError as e:5 print( '键错误')6 except IndexError as e:7 print ('索引错误')8 except Exception, as e:9 print ('错误')
以上就是Python异常处理的详细内容,更多请关注Gxl网其它相关文章!
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did82308
1 s1 = 'hello'2 try:3 int(s1)4 except KeyError as e:5 print( '键错误')6 except IndexError as e:7 print ('索引错误')8 except Exception, as e:9 print ('错误')
以上就是Python异常处理的详细内容,更多请关注Gxl网其它相关文章!
上一篇: Python对象,名字以及绑定