您可以遍历字典中的每个项目(键值对),然后将它们添加到结果字典中(如果值不在结果字典中)。
input_raw = {112762853378: {'dst': ['10.121.4.136'], 'src': ['1.2.3.4'], 'alias': ['www.example.com'] }, 112762853385: {'dst': ['10.121.4.136'], 'src': ['1.2.3.4'], 'alias': ['www.example.com'] }, 112760496444: {'dst': ['10.121.4.136'], 'src': ['1.2.3.4'] }, 112760496502: {'dst': ['10.122.195.34'], 'src': ['4.3.2.1'] }}result = {}for key,value in input_raw.items(): if value not in result.values(): result[key] = valueprint result
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)