day 13 python use json instead of eval

hat tip to benharri
main
magical 2022-12-13 10:35:29 -08:00
parent 10293ec22d
commit 6c175f2d8e
1 changed files with 2 additions and 1 deletions

View File

@ -1,7 +1,8 @@
import json
data = []
for chunk in open("input").read().split("\n\n"):
data.append([eval(x) for x in chunk.splitlines(False)])
data.append([json.loads(x) for x in chunk.splitlines(False)])
def less(a, b):
if type(a) == int and type(b) == int: