I'm looking for a Pythonic way to create a nested dictionary from a list and dictionary. Both the statements below produce the same result:
a = [3, 4]
b = {'a': 1, 'b': 2}
c = dict(zip(b, a))
c = {k: v for k, v in zip(b, a)}
Output is:
{3: 'a', 4: 'b'}
The desired result is:
{3: {'a': 1}, 4: {'b': 2}}
I could start using loops, but I don't believe that is necessary. And off course, afterwards I will need to flatten those dictionaries again.