只能用python解答 处理这文本难题。问题描述 详见 问题补充,最好用最优效率最高解法。
今天来做一个题目,有一个文件,内容如下:[root@Virtualpython]#cata.csv源文件2004-5-27,2,3,2,32004-5-27,872,0,...
今天来做一个题目,有一个文件,内容如下:
[root@Virtual python]# cat a.csv 源文件
2004-5-27,2,3,2,3
2004-5-27,872,0,872,0
2004-5-27,1872,0,872,0
2004-5-27,3872,0,872,0
2004-5-27,9872,0,872,0
2004-5-29,1762,24,1762,24
2004-5-28,2011,20,2011,20
需求是对文件内容的第二列内容进行排序,排序之后如下显示:
[root@Virtual python]# cat b.csv
2004-5-27,2,3,2,3
2004-5-27,872,0,872,0
2004-5-29,1762,24,1762,24
2004-5-27,1872,0,872,0
2004-5-28,2011,20,2011,20
2004-5-27,3872,0,872,0
2004-5-27,9872,0,872,0 展开
[root@Virtual python]# cat a.csv 源文件
2004-5-27,2,3,2,3
2004-5-27,872,0,872,0
2004-5-27,1872,0,872,0
2004-5-27,3872,0,872,0
2004-5-27,9872,0,872,0
2004-5-29,1762,24,1762,24
2004-5-28,2011,20,2011,20
需求是对文件内容的第二列内容进行排序,排序之后如下显示:
[root@Virtual python]# cat b.csv
2004-5-27,2,3,2,3
2004-5-27,872,0,872,0
2004-5-29,1762,24,1762,24
2004-5-27,1872,0,872,0
2004-5-28,2011,20,2011,20
2004-5-27,3872,0,872,0
2004-5-27,9872,0,872,0 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询