相关疑难解决方法(0)

如何按数字顺序Python按键对字典进行排序

这是字典看起来像:

{'57481': 50, '57480': 89, '57483': 110, '57482': 18, '57485': 82, '57484': 40}  
Run Code Online (Sandbox Code Playgroud)

我想按数字顺序对字典进行排序,结果应该是:

{'57480': 89, '57481': 50, '57482': 18, '57483': 110, '57484': 40, '57485': 82} 
Run Code Online (Sandbox Code Playgroud)

我试过sorted(self.docs_info.items)但它不起作用.

python sorting dictionary

19
推荐指数
3
解决办法
4万
查看次数

标签 统计

dictionary ×1

python ×1

sorting ×1