Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
List 在它的列表中查找缺席词典_List_Python 2.7_Dictionary - Fatal编程技术网

List 在它的列表中查找缺席词典

List 在它的列表中查找缺席词典,list,python-2.7,dictionary,List,Python 2.7,Dictionary,我需要比较两个字典列表并检索缺席元素,“connection”是标识对象的属性。其他属性可能随时间而变化。我试着用过滤器和地图,但我还是被卡住了 输入应如下所示: list1 = [{'username': 'user1', 'connection': "0x2083588'", 'remote': '10.0.5.251:44840','uri': 'www.google.com:443','seconds': '600'} ,{'username': 'user2', 'co

我需要比较两个字典列表并检索缺席元素,“connection”是标识对象的属性。其他属性可能随时间而变化。我试着用过滤器和地图,但我还是被卡住了

输入应如下所示:

list1 = [{'username': 'user1', 'connection': "0x2083588'", 'remote': '10.0.5.251:44840','uri': 'www.google.com:443','seconds': '600'}
        ,{'username': 'user2', 'connection': "0x2a90d778'", 'remote': '10.0.5.251:44796','uri': 'mobilenetworkscoring-pa.googleapis.com:443','seconds': '600'}]


list2 = [{'username': 'user1', 'connection': "0x2083588'", 'remote': '10.0.5.251:44840','uri': 'www.google.com:443','seconds': '400'}
        ,{'username': 'user2', 'connection': "0x2a90d778'", 'remote': '10.0.5.251:44796','uri': 'mobilenetworkscoring-pa.googleapis.com:443','seconds': '400'}
        ,{'username': 'user3', 'connection': "0x2a90d678'", 'remote': '10.0.5.251:44796','uri': 'mobilenetworkscoring-pa.googleapis.com:443','seconds': '400'}]
[{'username': 'user3', 'connection': "0x2a90d678'", 'remote': '10.0.5.251:44796','uri': 'mobilenetworkscoring-pa.googleapis.com:443','seconds': '400'}]
输出应如下所示:

list1 = [{'username': 'user1', 'connection': "0x2083588'", 'remote': '10.0.5.251:44840','uri': 'www.google.com:443','seconds': '600'}
        ,{'username': 'user2', 'connection': "0x2a90d778'", 'remote': '10.0.5.251:44796','uri': 'mobilenetworkscoring-pa.googleapis.com:443','seconds': '600'}]


list2 = [{'username': 'user1', 'connection': "0x2083588'", 'remote': '10.0.5.251:44840','uri': 'www.google.com:443','seconds': '400'}
        ,{'username': 'user2', 'connection': "0x2a90d778'", 'remote': '10.0.5.251:44796','uri': 'mobilenetworkscoring-pa.googleapis.com:443','seconds': '400'}
        ,{'username': 'user3', 'connection': "0x2a90d678'", 'remote': '10.0.5.251:44796','uri': 'mobilenetworkscoring-pa.googleapis.com:443','seconds': '400'}]
[{'username': 'user3', 'connection': "0x2a90d678'", 'remote': '10.0.5.251:44796','uri': 'mobilenetworkscoring-pa.googleapis.com:443','seconds': '400'}]

你能分享一下你作为一名教师所做的尝试吗?谢谢。在这个网站上,只有代码的答案通常是不受欢迎的。请编辑您的答案,包括一些注释或对代码的解释,好吗?解释应该回答这样的问题:它做什么?它是如何做到的?它去哪里了?它如何解决OP的问题?请参阅:。谢谢