LoginSignup
0
0

More than 5 years have passed since last update.

めざせpythonライブラリマスター (22)htmltag

Posted at

【ライブラリ説明】

 pythonでHTMLタグを生成できます。

【準備】

 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>

【参考サイト】

 github

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0