Skip to content

Commit a8ca2ef

Browse files
committed
Update 113.md
L.sort(key=None, reverse=False) -> None -- stable sort *IN PLACE* #Python3版本(因为Python3中去掉了cmp函数)
1 parent 87728b3 commit a8ca2ef

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎113.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
>>> all_users
6464
['python', 'http://', 'qiwsir', 'github', 'io', 'algorithm']
6565

66-
在all_users中,没有索引最大到4,如果要`all_users.insert(5,"algorithm")`,则表示将`"algorithm"`插入到索引值是5的前面,但是没有。换个说法,5前面就是4的后面。所以,就是追加了。
66+
在all_users中,没有索引5,最大到4。如果要`all_users.insert(5,"algorithm")`,则表示将`"algorithm"`插入到索引值是5的前面,但是没有。换个说法,5前面就是4的后面。所以,就是追加了。
6767

6868
其实,还可以这样:
6969

@@ -192,13 +192,13 @@ reverse比较简单,就是把列表的元素顺序反过来。
192192
193193
###sort
194194

195-
sort就是对列表进行排序。帮助文档中这么写的:
195+
sort就是对列表进行排序。输入help(list.sort)调用帮助文档,可以得到如下内容:
196196

197-
>sort(...)
198-
199-
> L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;
197+
sort(...)
198+
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; #Python2版本
200199
cmp(x, y) -> -1, 0, 1
201-
200+
201+
L.sort(key=None, reverse=False) -> None -- stable sort *IN PLACE* #Python3版本(因为Python3中去掉了cmp函数)
202202

203203
>>> a = [6, 1, 5, 3]
204204
>>> a.sort()

0 commit comments

Comments
 (0)