我有一个字典,其键的值不同,每个值又是一个字典。我需要根据(dict值)对键的值进行排序(除dict外什么也没有)
sample_dict = {"carry": {'r099':{'comment':'sample program','date':'today','action':'not_needed','gmail':'www.example.com','customer':['external'].'type':'non employess'},'r120':{'comment':'program2','date':'today','action':'completed','gmail':'www.example.com','customer':['internal'],type:'employee'},'s234':{'comment':'New user' program','date':'today','action':'not_needed','gmail':'www.example.com','customer':['outsourcing'],'type':'employee'}}
必需的输出:
sample_dict = {"carry": {'s234':{'comment':'New user' program','date':'today','action':'not_needed','gmail':'www.example.com','customer':['outsourcing'],'type':'employee'},'r099':{'comment':'sample program','date':'today','action':'not_needed','gmail':'www.example.com','customer':['external'].'type':'non employess'},'r120':{'comment':'program2','date':'today','action':'completed','gmail':'www.example.com','customer':['internal'],type:'employee'}}
具有'customer':['outsourcing']
的基本密钥应该是"carry"
密钥的第一个值,而'customer':['non employess']
是密钥的2个值。
基于"Carry"
的{{1}}键的Srt值