Including a Variable In the HTML Tags When Sending An Email

Richard Damon Richard at Damon-Family.org
Sun Aug 9 19:04:55 EDT 2020


On 8/9/20 6:22 PM, sammy.jackson987 at gmail.com wrote:
> On Sunday, August 9, 2020 at 1:32:30 AM UTC+1, Richard Damon wrote:
>> On 8/8/20 8:03 PM, sammy.jackson987 at gmail.com wrote:
>>> If i use place holders i.e. {0} and {1} where {0} is the name and {1} is the dataframe i get an error for the following line of code:-
>>> .format((Name,Body).to_html()) which states 'tuple' object has no attribute 'to_html'.
>> I would do it as
>>
>> .format(Name, Body.to_html()) if your names really are just straight
>> letters.
>>
>> If they might have some funny characters that need html handling, you
>> could do:
>>
>> import html
>>
>>
>> .format(html.escape(Name), Body.to_html())
>>
>>
>> Note that different types need to be treated differently to get them
>> into clean html.
>>
>>
>> -- 
>> Richard Damon
>
> Richard I love you.
>
> The following change you recommended worked. 
>
>
Now spend a bit of time understanding why that works, how it is
different from what you did, and what you can learn from it so you can
do other things than just follow a rote recipe.

-- 
Richard Damon



More information about the Python-list mailing list