1234567891011121314 |
- PLACEHOLDER = "[name]"
- with open("Input/Names/invited_names.txt") as names_file:
- names = names_file.readlines()
- with open("Input/Letters/starting_letter.txt") as letter_file:
- letter_text = letter_file.read()
- for name in names:
- striped_name = name.strip()
- new_letter = letter_text.replace(PLACEHOLDER, striped_name)
- with open(f"Output/ReadyToSend/letter_to_{striped_name.lower()}.txt", "w") as output_letter:
- output_letter.write(new_letter)
|