I have a 3 dimensional dictionary
d = ({k1:{k2:{k3:v}}}
and many more such keys....)
Now, I want to sort this dictionary by k3? What is the best way to do this?
sorted_keys = sorted(d.keys(),key=lambda x:d[x]['key2']['key3'])
将为您排序键...(因为字典按定义未排序)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.