numpy 对字典进行排列

import operator
import numpy as np
dia={'A':2,'B':1}
#对字典值进行排序
sortDia=np.sorted(dia.iteritems(),key=operator.itemgetter(1),reverse=True)
print(sortDia)

猜你喜欢

转载自blog.csdn.net/th_num/article/details/80329643