main.py 471 B

1234567891011121314
  1. PLACEHOLDER = "[name]"
  2. with open("Input/Names/invited_names.txt") as names_file:
  3. names = names_file.readlines()
  4. with open("Input/Letters/starting_letter.txt") as letter_file:
  5. letter_text = letter_file.read()
  6. for name in names:
  7. striped_name = name.strip()
  8. new_letter = letter_text.replace(PLACEHOLDER, striped_name)
  9. with open(f"Output/ReadyToSend/letter_to_{striped_name.lower()}.txt", "w") as output_letter:
  10. output_letter.write(new_letter)