This question has been answered before, but my string doesn't have any extra curly brackets that would mess up the formatting, so at the moment I'm completely clueless as to why the error
Error is KeyError : 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)
you could do it line by line using a dictionary and passing the dict as keyword arguments using **
d=dict()
d['model']=model
d['content']=data
d['theaders']=theaders
html = html.format(**d)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With