python list排序
摘要:
很多时候,我们需要对List进行排序,Python提供了两个方法对给定的List L进行排序,方法1.用List的成员函数sort进行排序方法2.用built-in函数sorted进行排序(从2.4开始)这两种方法使用起来差不多,以第一种为例进行讲解:从Python2.4开始,sort方法有了三个可选的参数,Python Library Reference里是这样描述的cmp:cmp specifies a custom comparison function of two arguments (iterable elements) which should return a negative 阅读全文
posted @ 2012-10-26 21:18 百年孤寂dwn 阅读(328) 评论(0) 推荐(1) 编辑