I have a dictionary Items
Items = {1: 1, 2: 2, 3: 2, 4: 2, 5: 2, 6: 3, 7: 4, 8: 5}
I want to map the values of Items on a list of dictionaries named loaded
loaded = [{6: [4, 1, 3]}, {1: [5]}, {10: [8, 6]}, {6: [7]}, {2: [2]}]
such that I get this as my outcome:
u_loaded = [{6: [2, 1, 2]}, {1: [2]}, {10: [5, 3]}, {6: [4]}, {2: [2]}]
I tried running loops and replacing the values if a match is found but it's not working
for i in loaded_list:
for k,v in i.items():
for j in v:
for a,b in pid_itemid_dic.items():
if j==a:
j=b
Output