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成神之路。
共有 0 条评论