AdventOfCode/2023/day1/part1/part1.py

15 lines
228 B
Python

#!/bin/python3
import re
import sys
input_f = sys.argv[1]
count = 0
with open(input_f) as file:
for line in file:
x=re.findall('\d{1}',line.rstrip())
count = count + int(x[0] + x[len(x)-1])
print(count)