Created
May 26, 2013 02:35
-
-
Save stevehenderson/5651508 to your computer and use it in GitHub Desktop.
python program to open all files in a directory and concatenate their contents into a single output file
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
from glob import iglob | |
import shutil | |
import os | |
import fileinput | |
PATH = '*.csv' | |
with open("all_da.txt", 'w') as fout: | |
for filename in iglob(PATH): | |
for line in fileinput.input(filename): | |
fout.write(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment