My Advent of Code solutions in Python. kevinyap.ca/2019/12/going-fast-in-advent-of-code/
advent-of-code python
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Convert parsed numbers to integers

+8 -1
+8 -1
2016/utils.py
··· 10 10 11 11 12 12 def parse_line(regex, line): 13 - return re.match(regex, line).groups() 13 + ret = [] 14 + for match in re.match(regex, line).groups(): 15 + try: 16 + ret.append(int(match)) 17 + except ValueError: 18 + ret.append(match) 19 + 20 + return ret 14 21 15 22 16 23 def mul(lst):