python sorted函数返回值2
时间: 2023-08-20 19:13:05 浏览: 93
回答: Python的sorted函数返回一个新的已排序的列表,而不是在原来的基础上进行操作。\[2\]在你提供的例子中,sorted函数对字典进行排序,并返回一个按照字典值降序排列的新列表。\[1\]所以,sorted函数返回的值是\[('C', 3), ('A', 2), ('B', 1)\]。
#### 引用[.reference_title]
- *1* [Python sorted()函数](https://blog.csdn.net/JoshuaJosue/article/details/105398862)[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^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [python内置函数sorted()](https://blog.csdn.net/qq_44940689/article/details/122527259)[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^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [python中 sort方法 和sorted函数](https://blog.csdn.net/weixin_39528289/article/details/110350276)[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^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文