对下面的Dict:
aps = {}
for key in T.keys():
ap = average_precision(T[key], P[key])
aps[key] = ap
如果用value从大到小排序:
aps = sorted(aps.items(), key=lambda d:d[1], reverse = True)
如果对key排序,用d[0];默认的是从小到大排序,如果是从大到小,需要用reverse = True.
注意返回的是一个List,不再是Dict.
0