You can generate HTML tags in python.
Requires pip install sphinx
htmltag.py
# -*- coding: utf-8 -*-
from htmltag import strong, foobar, a
from htmltag import table, tr, td
print (strong("SO STRONG!"))
# <strong>SO STRONG!</strong>
print foobar('Custom tag example')
# foobar>Custom tag example</foobar>
print (a('awesome software', href='http://liftoffsoftware.com/'))
# <a href="http://liftoffsoftware.com/">awesome software</a>
print(table(
tr(td('100'), td('200'), id="row1"),
tr(td('150'), td('250'), id="row2"),
))
# <table><tr id="row1"><td>100</td><td>200</td></tr><tr id="row2"><td>150</td><td>250</td></tr></table>
Recommended Posts