#Author Kang
try:
name = [1,2,3]
print(name[2])
print(name[3]) #代码发生错误,执行Expection
except Exception as e: #抓取所有错误
print("错误信息:",e)
结果:
3
错误信息: list index out of range
Copyright © 2009-2022 www.wtcwzsj.com 青羊区广皓图文设计工作室(个体工商户) 版权所有 蜀ICP备19037934号