📜  python 按值排序字典 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:57.908000             🧑  作者: Mango

代码示例6
x = {1: 2, 3: 4, 4: 3, 2: 1, 0: 0}
{k: v for k, v in sorted(x.items(), key=lambda item: item[1])}