Draymonders / Code-Life

The marathon continues though.
27 stars 3 forks source link

python3中多条件排序 #71

Open Draymonders opened 4 years ago

Draymonders commented 4 years ago

这里的trips是个[[0,1,2], [0,1,3]]的数据

按照第三维升序,第二维降序

trips.sort(key=lambda x : (x[2], -x[1]))