Last active
September 13, 2016 17:07
-
-
Save scuerda/a0b876d2816ee503b23695742cca3987 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
files = ['file1.csv', 'file2.csv', 'file3.csv'] | |
rows = [] | |
for file in files: | |
with open(file, 'r') as datafile: | |
reader = csv.DictReader(datafile) | |
for row in reader: | |
row.append(row) | |
with open('outfile.csv', 'w') as outfile: | |
writer = csv.DictWriter(outfile) | |
writer.writeheader(rows[0].keys()) | |
for row in rows: | |
writer.writerows(row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment