标签:sorted get sort class rev 排序 div ted font
dic_class={‘4‘:3,‘5‘:5,‘1‘:1}
dic_class_sorted = sorted(dic_class, key=dic_class.__getitem__, reverse=True)
print(dic_class_sorted)
输出:
[‘5‘, ‘4‘, ‘1‘]
sorted函数:返回的是字典的键,reverse=True,按照键值从大到小排序
标签:sorted get sort class rev 排序 div ted font
原文地址:https://www.cnblogs.com/shuangcao/p/12468403.html