advent-of-code-2022/day8/utils.py

19 lines
380 B
Python
Raw Normal View History

2022-12-16 19:52:30 +00:00
def load_trees(filename):
trees = []
with open(filename, "r", encoding="utf-8") as f:
for line in f:
contents = line.strip()
if not contents:
continue
row_of_trees = []
for char in contents:
row_of_trees.append(int(char))
trees.append(row_of_trees)
return trees