with open("app/emails/frontend/emails.html", "r") as f: content = f.read() target = ' \n \n ' replacement = target + ' \n \n ' content = content.replace(target, replacement) with open("app/emails/frontend/emails.html", "w") as f: f.write(content)