from glob import glob import os files = glob("content/**", recursive=True) print(files) print("----------") for file in files: #print(file) if file.endswith(".md"): print(file) html_file = file.replace(".md" , ".html") pandoc_cmd = "pandoc -f markdown -t html" + file + "-o " os.system(pandoc_cmd) print("html file saved!") html_files = glob("content/**", recursive=True) print("----------") all_html = "" for html_file in html_files: if file.endswith(".html"): print(html_file) #open the html file and read teh content html = open(html_file).read() # add this content to all_html all_html += html print("------------") print(all_html) output = open()