以下是我需要在我的列表中执行的逻辑步骤
a = [[5,2],[7,4],[0,3]]
sort the list of lists in such a way that the output looks something like
7,5,4,3,2,0
take the coordinates of the sorted elements in the original list, which in this case should produce as output
(1,0) (0,0) (1,1) (2,1) (0,1) (2,0)
我尝试使用sort、sorted
和argwhere
,但是以不同的方式使用后,得到的结果并不合理。我猜这是因为sort
和sorted
只能按照一个轴排序列表。