LoginSignup
3
3

More than 5 years have passed since last update.

めざせpythonライブラリマスター (9)WebHelpers

Posted at

【ライブラリ説明】

 pythonを使ってHTMLを書けます。
 webフレームワークの手助けとなります。

【プログラム】

WebHelpers.py
# -*- coding: utf-8 -*-

import webhelpers.html.tags as fm
import webhelpers.html.builder as html

print fm.form("/submit")
# <form action="/submit" method="post">

print fm.form("/submit", method="get")
# <form action="/submit" method="get">

print fm.text("address")
# <input id="address" name="address" type="text" />

print fm.text("color", type="color")
# <input id="color" name="color" type="color" />

print fm.textarea("body", "", cols=25, rows=10)
# <textarea cols="25" id="body" name="body" rows="10"></textarea>

print html.HTML.a("Foo", href="http://example.com/", class_="important")
# <a class="important" href="http://example.com/">Foo</a>

【参考サイト】

 WebHelpers
 document

3
3
2

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
3
3