📜  排序字典python代码示例

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

代码示例6
A={1:2, -1:4, 4:-20}
{k:A[k] for k in sorted(A)}

output:
{-1: 4, 1: 2, 4: -20}