a = ["秦时明月","长沙","女"]
bafenshu = ["八分熟","上海","未知"]
# 字典 键-值对 key-value
# 定义: {} key:value 每一个值之间用,隔开
# key:固定不变。字符串、数字、布尔值、元组。通用的字符串。
# value: 任意类型。
# 关键字:dict
# 无序,没有索引的概念。 key必须要唯一。
my_dict = {}
my_info = {"name":"xiaojian", "sex":"female", "city":"长沙", "hobby":"听音乐"}
print(my_info)
# 读取字典当中的数据。根据key来读取值。 字典变量名[key]
print(my_info["hobby"])
# 修改value 字典变量名[已有的key] = new_value
my_info["hobby"] = "游泳,吃小龙虾"
print(my_info)
# 增加key-value 我喜欢的动漫 字典变量名[新的key] = new_value
my_info["cation"] = "魔道祖师"
print(my_info)
# 删除key-value 字典变量名.pop(key)
my_info.pop("sex")
print(my_info)
# 字典的长度 len(字典变量名)
print(len(my_info))