I need to find k-smallest values of tuples according to their second indexes in python,
for example i have a list of tuples that contain distance of some points from the fix point, like : [('p1',12.5),('p2',3),('p4',1),('p5',16),('p6',15),...](from fixed point p0)
and i want to find k-smallest values according to distances.
I mean something like this code, which is explianed here : Find the k smallest values of a numpy array
I would appreciate for your solutions