aoc-solutions/2024/day1/part1/step1/step1.py

23 lines
358 B
Python
Raw Normal View History

2024-12-01 19:47:57 +00:00
import json
file = open("list.txt","r")
l1 = []
l2 = []
for i in file:
a,b = i.strip().split(" ")
a = int(a)
b = int(b)
l1.append(a)
l2.append(b)
file.close()
l1.sort()
l2.sort()
with open('l1.json', 'w') as l1file:
json.dump(l1,l1file)
l1file.close()
with open('l2.json', 'w') as l2file:
json.dump(l2,l2file)
l2file.close()