python dictionary obj, update() method

A.uqdate(B)

A 和 B 皆為 dictionary
則, 執行完上述指令後
B 的內容會融合進 A
若A 有相同的內容
則會被B 的內容覆蓋

ex:

A = {'a': 1, 'b': 2}
     
B = {'a': 3}

A.uqdate(B)
--> {'a': 3, 'b': 2}


留言

熱門文章