diff options
author | emkael <emkael@tlen.pl> | 2014-10-14 14:53:56 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2014-10-14 14:53:56 +0200 |
commit | 1dd94935d01370afb9976dd834fb1704735f14fb (patch) | |
tree | 1fabe7d8917b2d628521dddb6e9d4a01f5204463 | |
parent | 8553dd278264241ce99c52609140b9ffb6cdd9b5 (diff) |
* referencing files in result CSV
-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: |