# 遍历字典
for k, v in dic.items() # 遍历键值对
for k in dic.keys() # 遍历键
for v in dic.values() # 遍历值
# 将两个列表组成字典 zip
lst1 = ['a', 'b']
lst2 = [1,2]
zips = zip(lst1, lst2)
print(zips) # <zip object at 0x7f903c513240>
print(dict(zips)) # {'a': 1, 'b': 2}
# 字典新增键值对
dic = {'a': 1, 'b': 2}
dic['c'] = 3
print(dic) # {'a': 1, 'b': 2, 'c': 3}
10-21
237
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)