<p>有没有办法用多个数字对字典值进行排序?我尝试过这里使用的方法:<a href="https://stackoverflow.com/questions/28179125/how-to-sort-a-dictionary-to-print-from-highest-value-to-lowest-for-each-key">How to sort a dictionary to print from highest value to lowest for each key?</a>,但它只适用于整数值的个位数。例如,我的代码当前如下所示:</p>
<pre><code>for line in students:
student = line.split(' ')
d[student[1]] = (student[3])
print (d)
od = sorted(d.items(), key=lambda x: x[1], reverse=True)
print(od)
</code></pre>
<p>其中students是此文本文件的.readlines()的结果,我使用第一个分数:</p>
^{pr2}$
<p>丹尼应该是字典中的第一个条目,但是我的实际输出是:</p>
<pre><code>[('kirsty', '9'), ('bruce', '7'), ('anne', '4'), ('danny', '10'), ('charlie', '1')]
</code></pre>
<p>谁能帮忙吗?在</p>