python_exception_learning

# author: Roy.G
data={"roy":1,"boy":2}
data1=[1,2,3]
try:
data["roy"]
data[5]
# except (KeyError,IndexError) as e:
except Exception as e: # detect all exception
print("exception;",e)

posted on 2022-01-17 14:36  ttm6489  阅读(29)  评论(0编辑  收藏  举报

导航