From 6c175f2d8e8dfe566ff8ad34697a4ddc372c65d3 Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Tue, 13 Dec 2022 10:35:29 -0800 Subject: [PATCH] day 13 python use json instead of eval hat tip to benharri --- day13/sol.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/day13/sol.py b/day13/sol.py index 238548a..bd3bbbe 100644 --- a/day13/sol.py +++ b/day13/sol.py @@ -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: