且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

按x然后按y对字典列表进行排序

更新时间:2023-02-06 13:57:54

您的示例对我有用.我建议您不要使用list作为变量名,因为它是内置类型.

Your example works for me. I would advise you not to use list as a variable name, since it is a builtin type.

您也可以尝试执行以下操作:

You could try doing something like this also:

list.sort(key=lambda item: (item['points'], item['time']))