Reputation: 7805
I have dictionary and would like to produce html page where will be drawn simple html table with keys and values. How it can be done from python code?
Upvotes: 5
Views: 14603
Reputation: 676
Along with the numerous template engines, you might consider using Python's built in Template. It will give you basic templating functionality without needing to learn (or choose) a template library.
Upvotes: 0
Reputation: 11284
output = "<html><body><table>"
for key in your_dict:
output += "<tr><td>%s</td><td>%s</td></tr>" % (key, your_dict[key])
output += "</table></body></html>
print output
Upvotes: 10