Hello Stackoverflow people,
I have a nested dictionary with lists as values and I want to create a dict where all the list entries get their corresponding key as value.<
Use dictionary comprehension:
d = {'a': 'b', 'c': 'd', 'e': 'f'} d2 = dict((v1, k) for k, v in d.items() for v1 in v) # Here is the one-liner