Ok so what I have is:
foo = {1: {'f1': 'c1'}, 2: {'f2': 'c2'}}
What I want to get using list comprehension(if possible of course) is merge all 2nd level dictionary values this:
bar = {'f1': 'c1', 'f2': 'c2'}
What I tried is this:
bar = {k:v for k, v in tmp.items() for tmp in list(foo.values())}
Now this gets me:
NameError: name 'tmp' is not defined
This seamed like logical solution but apparently its a no go, could you please suggest a solution using list comprehension if possible, or some other one liner, or if that would not be possible an insight into why I get this error will be good knowledge to have.
Thanks,