I have some kind of verbose logic that I'd like to compact down with some comprehensions.
Essentially, I have a dict object that I'm reading from which has 16 values in it that I'm concerned with. I'm getting the keys that I want with the following comprehension:
["I%d" % (i,) for i in range(16)]
The source dictionary kind of looks like this:
{ "I0": [0,1,5,2], "I1": [1,3,5,2], "I2": [5,9,10,1], ... }
I'd like to essentially map this dictionary to be something like this:
[
{ "I0": 0, "I1": 1, "I2": 5, ... }
{ "I0": 1, "I1": 3, "I2": 9, ... }
...
]
How can I map things with list and dictionary comprehensions to transform my source dict into my destination list of dictionaries?