Including a Variable In the HTML Tags When Sending An Email

sammy.jackson987 at gmail.com sammy.jackson987 at gmail.com
Sun Aug 9 18:22:08 EDT 2020


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. 




More information about the Python-list mailing list