我想根据评分按降序对行进行排序。你知道吗
这是我的excel工作表的当前格式。你知道吗
Minions 2015 6.4
Now You See Me 2013 7.3
Prisoners 2013 8.1
Rumor Has It 1993� 5.4
The Prestige 2006 8.5
The Proposal 2009 6.7
我想要这样的输出:
The Prestige 2006 8.5
Prisoners 2013 8.1
Now You See Me 2013 7.3
The Proposal 2009 6.7
Minions 2015 6.4
Rumor Has It 1993� 5.4
首先你需要阅读你可以使用
readlines()
然后您需要阅读列表中的每个元素:
并使用
itemgetter
(from operator import itemgetter
)对“行”进行排序:然后写一个新文件
所有代码:
相关问题 更多 >
编程相关推荐