On 1/29/2024 11:15 AM, Rich Shepard via Python-list wrote:
For my use 1) the salutation and email address (always with an '@') are
sequential and 2) I'm developing the script to extract both from the same
file.

I've looked at my Python books "Python Crash Course," "Effective Python,"
and "Python Tricks The Book" as well as web pages in my searches without
finding the answer to what may be a simple question: how to specify a
variable in one file that has its values in another file.

Specifically, how to I designate the salutation holder in the message file
and pass it the name value from the name/email address file?

If this explanation is not sufficiently clear I'll re-write it. :-)

TIA,

Rich

I'm assuming this is a continuation of a previous thread about working with alternate lines with salutation and address, and I assume you've got that worked out.

If you aren't going to use one or another existing template system, perhaps the easiest is to use unique strings in the message file. For example:

Dear __##so-and-so##__:
   Please don't write this message off as mere spam.
   Respectfully, Rich

Then you just do a replace of the unique string by the salutation. Don't change the original (i.e., template), make the changes to a copy that you will output.

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to