I've a nested dictionary DictA as below
Dict A
{
'a': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3', 'k4': 'v4,v5'},
'b': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3', 'k4': 'v4'}
}
Nested Dictionaries 'a' and 'b' are almost same except the value of 'k4'. How do I sort DictA based on the above difference in value's length.
I want the Dict A to be sorted as below,
Dict A =
{
'b': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3', 'k4': 'v4'},
'a': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3', 'k4': 'v4,v5'}
}
Please advise.