feat: python
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
my_dict = {"name": "Alice", "age": 25}
|
||||
|
||||
# try:
|
||||
# print(my_dict["abc"])
|
||||
# except KeyError:
|
||||
# print("错误,访问的键不存在")
|
||||
try:
|
||||
print(my_dict["abc"])
|
||||
except Exception as e:
|
||||
print(type(e)) # 打印异常的类型
|
||||
print(str(e)) # 打印异常的错误信息
|
||||
Reference in New Issue
Block a user