【发布时间】:2020-09-07 21:27:14
【问题描述】:
cursor.execute("""SELECT [APPL_NAME] ,[JOB_NAME],[LABE] FROM XYZ)
resultat = cursor.fetchall()
for row in resultat:
html_code = """
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<body>
<table border='1'
<tr>
<th>Date</th>
<th>Count</th>
<th>Status</th>
</tr>
<tr>
<td>{}</td>
<td>{}</td>
<td>{}</td>
</tr>
</table>
</body>
</html>""".format(row[0],row[1],row[3])
我正在尝试从数据库表中获取记录并通过电子邮件发送数据。在表中选择查询 10-20 记录。但是在电子邮件中只有一条记录打印在上面的代码表中。 我尝试了列表中的所有数据,但没有运气。请建议我如何格式化电子邮件中的所有选择表记录。谢谢
【问题讨论】:
标签: python python-3.x list python-2.7 python-requests