import random import re templates = open("template.txt").read().splitlines() delivery = open("delivery.txt").read().splitlines() events = open("event.txt").read().splitlines() def fill(line): line = re.sub(r"\{DELIVERY\}", lambda _: f"[{random.choice(delivery)}]", line) line = re.sub(r"\{EVENT\}", lambda _: f"[{random.choice(events)}]", line) return line VARIANTS = 10 scripts = [fill(t) for t in templates if t.strip() for _ in range(VARIANTS)] open("scripts.txt", "w").write("\n".join(scripts) + "\n") print(f"{len(scripts)} scripts written to scripts.txt")