Back

python - array的排序 list sort

发布时间: 2023-10-03 03:27:00

refer to:
https://www.programiz.com/python-programming/methods/list/sort

大概是这样:

>>> [3,2,5].sort()
>>> a = [3,2,5]
>>> a.sort()
>>> a
[2, 3, 5]

可以看出:

1. .sort() 方法不返回值

2. 会对原数组做改动。(没有进行clone, shadow等类似的操作)

Back