Is there any simple way to swap python dictionary key values where values are list My dictionary is like following
d={1:[1,2,3,4],2:[2,3,4],5:[1,3,6,7]}
I want to generate a dictionary from it like following
a={1:[1,5],2:[1,2],3:[1,2,5],4:[1,2],6:[5],7:[5]}
I tested with reversed
dict(map(reversed, d.items())
It won't iterate and create keys with items in the list returns TypeError: unhashable type: 'list'
I am looking for any inline methods available for achieving this