小编siw*_*ong的帖子

如何对列表中的列表进行排序?

我想知道如何对列表中的列表进行排序。但是,我不想按键对齐。我想按照以下方法进行更改。

arr = [[2, 3], [5, 1], [4, 1], [5, 3], [4, 2]]
# solution...
I_want_arr = [[2, 3], [1, 5], [1, 4], [3, 5], [2, 4]]
Run Code Online (Sandbox Code Playgroud)

我尝试过这个

for i in arr:
  i.sort()
Run Code Online (Sandbox Code Playgroud)

但是,它不起作用

python sorting list

0
推荐指数
1
解决办法
111
查看次数

标签 统计

list ×1

python ×1

sorting ×1