小编Man*_*cho的帖子

Python中按属性对字典进行排序

我想知道如何在 python3 中通过“col”asc 来排序。尝试排序和 orderDict。

d = {0: {'m1': 32, 'M1': 174, 'm2': 190, 'M2': 967, 'col': 6, 'cols': [2, 6, 11, 14, 15, 16, 18]},
 1: {'m1': 50, 'M1': 580, 'm2': 588, 'M2': 960, 'col': 10, 'cols': [2, 6, 7, 10, 11, 14, 15, 16, 17, 18, 19]},
 2: {'m1': 35, 'M1': 595, 'm2': 621, 'M2': 972, 'col': 8, 'cols': [2, 6, 10, 11, 14, 15, 16, 18, 19]},
 3: {'m1': 41, 'M1': 85, 'm2': 104, 'M2': 962, 'col': …
Run Code Online (Sandbox Code Playgroud)

python sorting dictionary tuples

1
推荐指数
1
解决办法
206
查看次数

标签 统计

dictionary ×1

python ×1

sorting ×1

tuples ×1