list 根据另一个list 的值排序
X = ['a','b','v','c','d','e']
Y = [3, 2, 0, 5, 1, 4]
Z = [x for _, x in sorted(zip(Y,X))]
print(Z)
Z = ['v','d','b','a','e','c']
Dict 根据Dict的value值,从大到小排序
X = {'a':2, 'b':1, 'c':3}
X= {k: v for k, v in sorted(X.items(), key=lambda item: item[1], reverse=True)}
print(X)
Z = {'c':3, 'a':2, 'b':1}