0
点赞
收藏
分享

微信扫一扫

对字典排序

回溯 2023-06-02 阅读 21

dict(
    sorted(
        dict_counts.items(),
        key= lambda x:x[1],
        reverse = False
    )
)

根据键值对字典排序

并转化为字典

https://www.freecodecamp.org/chinese/news/sort-dictionary-by-value-in-python/

举报

相关推荐

0 条评论