csv排序输出

n = int(input())
ls1 = []
with open('grade0.csv', 'r', encoding='utf-8') as f:
for line in f.readlines():
line = line.strip('/n')

ls = list(line.split(','))
ls1.append(ls)
ls1.sort(key=lambda x: (x[n - 1], x[0]))
for i in ls1:
print('/t'.join(i))

csv排序输出最先出现在Python成神之路

版权声明:
作者:Mr李
链接:https://www.techfm.club/p/17100.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>