いくつか方法があります。
1つめ
python
1>>> output = [["a",0.7],["b",0.8],["c",0.02],["d",0.9]]
2>>> l = [[y,x] for x,y in output]
3>>> l.sort(reverse=True)
4>>> [[x,y] for y,x in l]
5[['d', 0.9], ['b', 0.8], ['a', 0.7], ['c', 0.02]]
2つめ
python
1>>> output = [["a",0.7],["b",0.8],["c",0.02],["d",0.9]]
2>>> sorted(output, key=lambda x: -x[1])
3[['d', 0.9], ['b', 0.8], ['a', 0.7], ['c', 0.02]]
3つめ
python
1>>> from operator import itemgetter
2>>> output = [["a",0.7],["b",0.8],["c",0.02],["d",0.9]]
3>>> sorted(output, key=itemgetter(1), reverse=True)
4[['d', 0.9], ['b', 0.8], ['a', 0.7], ['c', 0.02]]
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。