python是否有任何内置的功能来通知dict更新时更改了哪些dictionary元素?例如,我正在寻找这样的功能:
>>> a = {'a':'hamburger', 'b':'fries', 'c':'coke'}
>>> b = {'b':'fries', 'c':'pepsi', 'd':'ice cream'}
>>> a.diff(b)
{'c':'pepsi', 'd':'ice cream'}
>>> a.update(b)
>>> a
{'a':'hamburger', 'b':'fries', 'c':'pepsi', 'd':'ice cream'}
我想查一本字典,里面有a.diff(b)结果中显示的更改值
目前没有回答
相关问题 更多 >
编程相关推荐