【发布时间】:2018-10-03 06:18:34
【问题描述】:
我有这个 python 列表
result =[('921', 36638, None, None, 'ron', '28-SEP', 'platform'),
('921', 36637, None, None, 'john', '28-SEP', 'platform')]
此列表中的值是动态的。但是表头始终是静态的。
Table header:
Issue Vers created_on Build Author Commit Source_Name
我想改变这个 python 输出并制作成一个 HTML 表格。
这是我目前的工作
z = import result
s =open(z)
table=['<htm><body><table border="1">']
for line in s.splitlines():
if not line.strip():
continue
table.append(r'<tr><td>{}</td><td>{}</td></tr>'.format(*line.split('--- ')))
table.append('</table></body></html>')
print ''.join(table)
我对放置静态标题感到困惑。谢谢
【问题讨论】:
标签: python html python-3.x