I am trying to e-mail an attachment and am formatting the content of my e-mail message.
For some reason when I do:
 variable = f"""
    email content formatting line 1
    email content formatting line 2
    email content formatting line 3
    """
The lines inside the """ """ don't all turn to string, and the rest of my code below becomes string. Any ideas why?
For example, the msg_text and msg.attach lines turn into string. How do I fix my f-string setup?
html = f"""
    <html><body>
    <h1> Monthly Accounting File ({month_end.strftime("%m/%d/%Y")})</h1>
    <p>{df.to_html(index=False)}</p>
    </body></html>
    """
msg_text = MIMEText(html, 'html')
msg.attach(msg_text)
If I add one space after f then my lines turn to string but I thought that wasn't the correct syntax for f-strings. This is for Jupyter Notebook Python 3.0. See below for example:
html = f """
    <html><body>
    <h1> Monthly Accounting File ({month_end.strftime("%m/%d/%Y")})</h1>
    <p>{df.to_html(index=False)}</p>
    </body></html>
    """
msg_text = MIMEText(html, 'html')
msg.attach(msg_text)
 
     
    