Skip to content

Instantly share code, notes, and snippets.

@lukasmartinelli
Last active August 29, 2015 14:17
Show Gist options
  • Save lukasmartinelli/6cb0bd2dc01cea918998 to your computer and use it in GitHub Desktop.
Save lukasmartinelli/6cb0bd2dc01cea918998 to your computer and use it in GitHub Desktop.
Fix missing quotes in csv
import fileinput
import re
import sys
if __name__ == "__main__":
for line in fileinput.input():
m = re.match(r"(.*/.*) (.*) (\d*)", line)
if m:
print('"{0}","{1}",{2}'.format(m.group(1),
m.group(2),
m.group(3)))
else:
sys.stderr.write(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment