MCPcopy Index your code
hub / github.com/kyclark/tiny_python_projects / read_csv

Function read_csv

19_wod/solution2.py:81–93  ·  view source on GitHub ↗

Read the CSV input

(fh)

Source from the content-addressed store, hash-verified

79
80# --------------------------------------------------
81def 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# --------------------------------------------------

Callers 2

test_read_csvFunction · 0.90
mainFunction · 0.70

Calls

no outgoing calls

Tested by 1

test_read_csvFunction · 0.72