Python 之 程序异常处理
代码
#Author Kangtry: name = [1,2,3] print(name[2]) print(name[3]) #代码发生错误,执行Expectionexcept Exception as e: #抓取所有错误 print("错误信息:",e)
结果:3错误信息: list index out of range
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。