First, creating a new HTML document is simply a matter of putting the relevant HTML as the argument of a print command:
print '''
content-type: text/html
<html>
<head>
<title> This is the title </title>
</head>
<body>
This is the body.
</body>
</html>
'''
Recall that triple quotes in Python tell it to print what follows verbatim. It disregards any character sequences for strings, etc. If you need to represent variable data, default to using the standard single quotation mark method.
x = "variable"With this information, one can create a bevy of HTML pages with variable content very quickly and automagically.
print "This is a %s." %(x)
