Created
January 3, 2024 11:51
-
-
Save glennhefley/08a7cc0d65acdd81d1dffd56f23ceacd to your computer and use it in GitHub Desktop.
A ConCat in Python
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
#I need a python script that will cat | |
#all of the *.html files in a single level directory | |
# into one file: newfile.html | |
import glob | |
import shutil | |
html_files = glob.glob('*.html') | |
with open('newfile.html', 'wb') as outfile: | |
for filename in html_files: | |
if filename == 'newfile.html': | |
# don't want to copy the output into the output | |
continue | |
with open(filename, 'rb') as readfile: | |
shutil.copyfileobj(readfile, outfile) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment