新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Python之程序異常處理
代碼
#Author Kang
try:
name = [1,2,3]
print(name[2])
print(name[3]) #代碼發(fā)生錯(cuò)誤,執(zhí)行Expection
except Exception as e: #抓取所有錯(cuò)誤
print("錯(cuò)誤信息:",e)
結(jié)果:
3
錯(cuò)誤信息: list index out of range
名稱欄目:Python之程序異常處理
本文路徑:http://www.ef60e0e.cn/article/gsjhoe.html