Last active
September 27, 2016 07:08
-
-
Save gurgeh/bd101552beaafc21f7af8ce543f9fb7f to your computer and use it in GitHub Desktop.
This file contains 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 | |
import os | |
def add_all(path, prefix): | |
rows = [] | |
first = True | |
for fname in os.listdir(path): | |
if fname.startswith(prefix): | |
with open(os.path.join(path, fname)) as inf: # join path and filename | |
c = csv.reader(inf) | |
if not first: # remove header from every file, but the first | |
c.next() # remove header | |
first = False | |
rows.extend(c) | |
return rows |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment