MkyTaP - 開發筆記
主要工具: Linux, Python, SQL
Showing posts with label
sorted
.
Show all posts
Showing posts with label
sorted
.
Show all posts
Saturday, May 11, 2019
Python: sorted 2d list by element, reverse
要按第一個元素倒排, 第二個元素正排︰
sorted(lista, key=lambda x: (-x[0], x[1]))
Older Posts
Home
Subscribe to:
Posts (Atom)