diff options
-rwxr-xr-x | dumps/second-a-lap.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/dumps/second-a-lap.py b/dumps/second-a-lap.py index dc9b86b..3d43cde 100755 --- a/dumps/second-a-lap.py +++ b/dumps/second-a-lap.py @@ -32,6 +32,8 @@ def fetch(url): def compile(files): headers = set() values = [] + writer = csv.writer(open('races.csv', 'w')) + race_id = 0 for path in files: try: with open(path, 'r') as csvfile: @@ -43,10 +45,14 @@ def compile(files): i = 0 for cell in row: data[header[i]] = cell + data['Race'] = race_id i += 1 values.append(data) + writer.writerow([race_id,path,'','','']) + race_id += 1 except IOError: pass + headers.add('Race') writer = csv.writer(open('compiled.csv', 'w')) writer.writerow(list(headers)) for row in values: |