You can write HTML using python. Helps the web framework.
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>
Recommended Posts