12 lines
310 B
Python
12 lines
310 B
Python
with open('data.txt','r') as file:
|
|
lines = file.readlines()
|
|
sorted_lines = []
|
|
for line in lines:
|
|
sorted_line=' '.join(sorted(line.split(), key=int))
|
|
sorted_lines.append(sorted_line)
|
|
|
|
with open('output.txt', 'w') as file:
|
|
for sorted_line in sorted_lines:
|
|
file.write(sorted_line + '\n')
|
|
|