key=lambda x: (-x[0],x[1])
时间: 2023-09-02 21:13:46 浏览: 157
python3 -sorted函数 对所有可迭代的对象进行排序操作 sorted(corr_list,key=lambda x: -abs(x[0]))
5星 · 资源好评率100%
这个问题是关于lambda表达式的用法。lambda表达式是一种匿名函数,可以用于简洁地定义一个函数。在这个问题中,key=lambda x: (-x<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Python | 关于 dic.sort(key=lambda x: (-len(x), x))的理解](https://blog.csdn.net/lovetaozibaby/article/details/120304801)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [基于Python字典(列表)Lambda函数的排序问题](https://blog.csdn.net/Muchenxi_/article/details/125022395)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文