I'm looking for a way to merge dictionaries by other means than dict(a.items()+b.items())
is doing.
Example:
foo = {'cart':
{'item':
{'1':
{'amount':
'X',
},
},
},
}
bar = {'cart':
{'item':
{'2':
{'amount':
'Y',
},
},
},
}
Wanted result:
res = {'cart':
{'item':
{'1':
{'amount':
'X'
},
},
{'2':
{'amount':
'Y',
},
},
},
}
Actual result (gotten bei dict(foo.items() + bar.items()):
res = {'cart':
{'item':
{'2':
{'amount':
'Y',
},
},
},
}
Thanks a lot in advance!