diff options
Diffstat (limited to 'csv-test.py')
-rw-r--r-- | csv-test.py | 16 |
1 files changed, 16 insertions, 0 deletions
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)) |