学习笔记(59):Python 面试100讲(基于Python3.x)-如何排序一个列表

立即学习:https://edu.csdn.net/course/play/26755/340127?utm_source=blogtoedu

 

1、使用sort和sorted都可以对列表进行排序

2、sort方法修改列表本身,而sorted函数返回一个列表的副本。
3、将reverse参数值设为True,可以对列表进行倒序排列

发布了73 篇原创文章 · 获赞 3 · 访问量 663

猜你喜欢

转载自blog.csdn.net/weixin_43186090/article/details/104466303