如何在Python的电子邮件中的html正文中引用python的变量?
直接上个栗子
html = '''
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="width:300px;">{line}</td>
<td style="width:300px;">{str_webmail_login_time}</td>
<td style="width:300px;">{days}</td>
</tr>
</tbody>
</table>
'''.format(line=list_newline[0], str_webmail_login_time=list_newline[1], days=list_newline[2])
这样就可以了
.format(code=code)