Last active
November 10, 2024 09:38
-
-
Save Rust1667/c781cffed9653e4dd1f1b6b0330655eb to your computer and use it in GitHub Desktop.
Python script used to combine all the .md files inside a folder into 1, adding the title of the file at the beginning of each of the joined sections. This script must be place inside that folder with the .md files.
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
outputFileName = 'single-page2' | |
import glob | |
filenames = glob.glob('*.md') | |
with open(outputFileName, 'w') as outfile: | |
for fname in filenames: | |
with open(fname) as infile: | |
fileTitleString = "\n\n\n" + "# " + fname + "\n" | |
outfile.write(fileTitleString) | |
for line in infile: | |
outfile.write(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment