I'm new to Python and I'm learning about dictionaries and I'd like to clarify something.
Let's say I have two dicts: d1 = {'id1' : '1', 'id2' : '2', 'id3' : '3', 'id4' : '4'}
and d2 = {'fruit1': 'Apple', 'fruit2': 'Banana', 'fruit3': 'Strawberry', 'fruit4': 'Kiwi'}
. I'd like to create a new dictioanry d3
with the following content:
{ 1 : Apple, 2 : Banana, 3 : Strawberry, 4 : Kiwi}
.
I've read this post How to merge two dictionaries in a single expression? but it's not exactly what I'm looking for.
What's the best way to create this new dictionary? Thanks!