fruit = {"name": "apple", "color": "red"}
try:
print(fruit["price"]) # 尝试访问不存在的键
except KeyError:
print("错误!您正在尝试访问字典中不存在的键!")
except:
print("发生了其他错误")