I want to make the code below to get formatted as HTML. However I'm having problem formatting it as HTML.
cur.execute("SELECT Statement")
rows = cur.fetchall()
html = """\
<table border='1'>
<tr><th>Date</th><th>DPC</th><th>TOTAL</th><th>Success</th></tr>
<tr>
for row in rows:
for col in row:
print "<td>"
print "%s".replace(" ", "") % col
print "</td>"
print "</tr>"
</table>
"""
My goal is to make it html output, however I don't know how to make the for loop output as formatted html.