Sorry, if this one is duplicate, but I am new to python and haven't found solution by googling.
I have a dictionary that looks like:
{
1 : ['x', 'y'],
2 : ['z'],
3 : ['a']
}
All values in lists are guaranteed to be unique. And I want to transform this dictionary to:
{
'x' : 1,
'y' : 1,
'z' : 2,
'a' : 3
}
What is the most pythonic and clean way to write this?