I have a nested defaultdict like this:
defaultdict(<function __main__.<lambda>()>,
{'A': defaultdict(<function __main__.<lambda>()>,
{'a':2,
'b':1,
'd':2,
'f':1}
'B': defaultdict(<function __main__.<lambda>()>,
{'a':3,
'c':4,
'e':1}}
I want to get an output like this:
B,c : 4
B,a : 3
A,a : 2
How can I sort a nested defaultdict like this?
Thanks for your help in advance.
How about flattening the default dict as a
Counter, then callingCounter.most_common?