Dali杂货铺🐰7——Python 字典操作详解

"dict..."

Posted by fuhao7i on March 14, 2021

1. update()方法

1
2
3
a = {'one': 1, 'two': 2, 'three': 3}
a.update({'one':4.5, 'four': 9.3})
print(a)

输出:

{'one': 4.5, 'two': 2, 'three': 3, 'four': 9.3}