from slugify import slugify title = input("Enter draft's title: ") slug = slugify(title) body = f""" --- title: {title} --- """ with open(f"_drafts/{slug}.gmi", mode="w", encoding="utf8") as file: file.write(body)