python中的update

it2026-05-08  5

python中的update

update()批量写入批量更新字典,举个例子:

1 a = { 2 "name":"dlrb", 3 "age":25, 4 "height":168 5 } 6 b = { 7 "husband":"zzq", 8 "dear":521 9 } 10 a.update(b) 11 print(a)

输出结果:

{'dear': 521, 'age': 25, 'name': 'dlrb', 'husband': 'zzq', 'height': 168}

我们将字典b批量写入到字典a中

posted on 2019-04-09 09:59 恒笛 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/xwqhl/p/10675107.html

最新回复(0)