会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
CharlesLC
Stay foolish, stay hungry.
博客园
首页
新随笔
联系
订阅
管理
2022年9月19日
python dict字典,按照Value升序, key降序
摘要: 按Value升序,按key降序 例子 dicts = {1:5, 2:4, 3:8, 4:9, 5:10, 6:5, 7:5} sort_dicts = dict(sorted(dicts.items(), key = lambda x:[x[1],-x[0]])) print(sort_dicts
阅读全文
posted @ 2022-09-19 14:20 CharlesLC
阅读(410)
评论(0)
推荐(0)
公告