graph LR
A(字典的创建) --> B(使用花括号)
A --> C(内置函数dict)
A --> D(字典生成式)
graph LR
A(常用操作) --> B(获取value)
B --> C(字典名+方括号key)
B --> D(字典名.get括号key)
A --> E(删除key-value对)
E --> F(del 字典名+方括号key)
A --> G(修改/新增)
G --> H(字典名+方括号key)
A --> I(in / not in)
#get the items (key-value) of dictionary
age_i=age.items()
print(age_i)
print(list(age_i))
#字典遍历
for i in age:
print(i,age.get(i))
#字典的 key 值不允许重复 value 可以重复
age={'nana':18,'nana':6}
print(age)
age={'nana':18,'nanami':18}
print(age)
#zip 打包 key 和 value
up_name=['粽子酱','补番目录','动漫唯美风','概念de天使']
up_sexual=['男','男','男','女']
up={name:sexual for name,sexual inzip(up_name,up_sexual)}#name 是键 sexual 是值
print(up)
up={name.upper():sexual for name,sexual inzip(up_name,up_sexual)}#upper 表大写