Skip to content

Instantly share code, notes, and snippets.

@prasincs
Created August 22, 2013 13:23
Show Gist options
  • Save prasincs/6307082 to your computer and use it in GitHub Desktop.
Save prasincs/6307082 to your computer and use it in GitHub Desktop.
import csv,sys
if len(sys.argv) < 3:
print "Need input and output filenames"
sys.exit(0)
inFile = open(sys.argv[1], "rU")
reader = csv.DictReader(inFile)
destFieldNames = reader.fieldnames
outFile = open(sys.argv[2], "w")
writer = csv.DictWriter(outFile, destFieldNames, quoting=csv.QUOTE_ALL)
writer.writeheader()
for row in reader:
writer.writerow(row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment