파이썬 - multi-column data array (list) sorting
>>> dist = [[25, 1], [12, 2], [11, 3]] ... ... >>> >>> dist.sort(key=lambda a: a[0]) # key function only looks at first element in row ie column 0 >>> dist [[11, 3], [12, 2], [25, 1]] >>> dist = dist[0:2] # take only the first 2 rows >>> dist [[11, 3], [12, 2]]