Read the CSV input
(fh)
| 79 | |
| 80 | # -------------------------------------------------- |
| 81 | def read_csv(fh): |
| 82 | """Read the CSV input""" |
| 83 | |
| 84 | exercises = [] |
| 85 | for row in csv.DictReader(fh, delimiter=','): |
| 86 | name, reps = row.get('exercise'), row.get('reps') |
| 87 | if name and reps: |
| 88 | match = re.match(r'(\d+)-(\d+)', reps) |
| 89 | if match: |
| 90 | low, high = map(int, match.groups()) |
| 91 | exercises.append((name, low, high)) |
| 92 | |
| 93 | return exercises |
| 94 | |
| 95 | |
| 96 | # -------------------------------------------------- |
no outgoing calls