Python 对字典的key进行排序

Python 对字典的key进行排序

1、好像没有现成的函数,需要自己写一个

sortedIndex = sorted(dict.keys())

sortedIndex 是一个list

然后再来一个for循环

for index in sortedIndex:

    dict[index ]

posted @ 2022-07-28 17:20  bH1pJ  阅读(18)  评论(0编辑  收藏  举报