Lambda
points = [ { 'x' : 2, 'y' : 3 },
{ 'x' : 4, 'y' : 1 } ]
points.sort(key=lambda i : i['y'])
print points
# output: [{'y': 1, 'x': 4}, {'y': 3, 'x': 2}]Last updated
points = [ { 'x' : 2, 'y' : 3 },
{ 'x' : 4, 'y' : 1 } ]
points.sort(key=lambda i : i['y'])
print points
# output: [{'y': 1, 'x': 4}, {'y': 3, 'x': 2}]Last updated