-
-
Save mjcreativeventures/d3295c9341264483b7ce to your computer and use it in GitHub Desktop.
Convert CSV data to Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timings = [ row.strip().split('\t') for row in file('timings.csv') ] | |
dups = dict() | |
dup_count = 0 | |
with open('timings.js', 'w') as outf: | |
outf.write('var timings = [\n') | |
for row in timings: | |
line = ','.join(row) | |
if not dups.has_key(line): | |
outf.write('[ %s ],\n' % line) | |
dups[line] = True | |
else: | |
dup_count += 1 | |
outf.write('];\n') | |
print 'Found %d duplicates.' % dup_count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment