python - Accessing multiple dictionary values -
i have 2 dictionaries in below format
d=defaultdict(<class 'collections.ordereddict'>, {u'1': ordereddict([(1746l, 1), (2239l, 1)]), u'2': ordereddict([(1965l, 2)]),u'3': ordereddict([(2425l, 1),(2056l, 4)])}) e={2056l: 3, 1746l: 3, 2239l: 2, 1965l: 3, 2425l: 4}
how can create dictionary of format??
{u'1':{1746l:(1,3),2239l:(1,2)},u'2':{1965l:(2,3)},u'3':{2425l:(1,4),2056l(4,3)}}
>>> {i: {j: (d[i][j], e[j]) j in d[i]} in d} {u'1': {1746l: (1, 3), 2239l: (1, 2)}, u'3': {2056l: (4, 3), 2425l: (1, 4)}, u'2': {1965l: (2, 3)}}
Comments
Post a Comment