import os import glob widget = """ """ # Add widget to all posts for filename in glob.glob("*/index.html", recursive=True): print(filename) with open(filename, "r+", encoding="utf-8") as f: txt = f.read().replace("", widget) f.seek(0) f.writelines(txt) # print(f.read()) # Add widget to home page with open("index.html", "r+", encoding="utf-8") as f: txt = f.read().replace("", widget) f.seek(0) f.writelines(txt) #