这个问题之前已经有人回答过了,但我的字符串中没有任何额外的花括号来破坏格式,所以我完全不知道这个错误为什么会出现。错误是关键字错误:content。
html = """
<table class=\"ui celled compact table\" model=\"{model}\">
{theaders}
<tbody>
{content}
</tbody>
</table>
"""
html = html.format(model=model)
html = html.format(content=data)
html = html.format(theaders=theaders)