Skip to content

Instantly share code, notes, and snippets.

@yosemitebandit
Created June 30, 2011 17:28
Show Gist options
  • Save yosemitebandit/1056718 to your computer and use it in GitHub Desktop.
Save yosemitebandit/1056718 to your computer and use it in GitHub Desktop.
process a csv, write to another csv
input_data = open('data.csv', 'r')
output_data = open('out.csv', 'w')
for line in input_data:
data = line[0:-2] # snip off the new line character and trailing comma
output_data.write( data + '\n' ) # add the newline back
input_data.close()
output_data.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment