从已知文本文件‘in.txt’中读取所有整数,请将其按照从小到大的顺序排列后写入‘out.txt’文件中
with open('in.txt','r') as f: a=sorted(list(map(int,f.read().split('\n')))) print(a) with open('out.txt','w+') as g: g.writelines('\n'.join(map(str,a)))