定义:
使用{} 来进行表示, 字典里面的值是键值对儿的形式存在的
{key: value, key1: value1, key2: value2}
# 小卤蛋的自杀历程
info = {"name": "小卤蛋", "age": 5}
# 字典的访问:
# a.根据key来进行访问
print("my name is %s, age is %d " % (info["name"], info["age"]))
# print("my father is %s"% info["father"])
# 字典的增加 格式 dict["new_key"] = new_value
info["father"] = "凯爹"
print("my father is %s" % info.get("father"))
info["aunt"] = "露娜"
info["uncle"] = "至尊宝"
print(info)
# 鲁班大师: 抽出七匹狼: 并对鲁班说: i m your father
# 字典的修改
info['father'] = '鲁班大师'
print(info)
# 字典的删除 del :根据key来进行删除
# del info["aunt"]
# del info["uncle"]
#
# print(info)
# clear()
# info.clear()
# print(info)