问题:
I have two dictionaries, and I need to find the difference between the two, which should give me both a key and a value.我有两本字典,我需要找出两者之间的区别,这应该给我一个键和一个值。
I have searched and found some addons/packages like datadiff and dictdiff-master, but when I try to import them in Python 2.7, it says that no such modules are defined.我搜索并找到了一些插件/包,如 datadiff 和 dictdiff-master,但是当我尝试在 Python 2.7 中导入它们时,它说没有定义这样的模块。
I used a set here:我在这里使用了一套:
first_dict = {}
second_dict = {}
value = set(second_dict) - set(first_dict)
print value
My output is:我的输出是:
>>> set(['SCD-3547', 'SCD-3456'])
I am getting only keys, and I need to also get the values.我只得到键,我还需要得到值。