From 199d786cb4accd50375164d1f65336bb08441092 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Wed, 31 Aug 2016 17:03:24 -0400 Subject: add scripts --- csv-test.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 csv-test.py (limited to 'csv-test.py') diff --git a/csv-test.py b/csv-test.py new file mode 100644 index 0000000..0662965 --- /dev/null +++ b/csv-test.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python2.7 + +import sys +import csv + +with open(sys.argv[1], 'rb') as src_file: + # create csv reader + src = csv.reader(src_file) + + with open(sys.argv[2], 'wb') as dst_file: + # create csv writer + dst = csv.writer(dst_file) + + # walk, mutate, and write rows + for row in src: + dst.writerow(row + (['foo'] * 2)) -- cgit v1.2.3