Output a HTML page : HTML : CGI Web PYTHON TUTORIALS


PYTHON TUTORIALS » CGI Web » HTML »

 

Output a HTML page


#!/usr/local/bin/python
import cgi

def header(title):
    print "Content-type: text/htmln"
    print "<HTML><HEAD><TITLE>%s</TITLE></HEAD><BODY>" (title)

def footer():
    print "</BODY></HTML>"

form = cgi.FieldStorage()
formkeys = form.keys()
formkeys.sort()
header("Show form fields")

print '<UL>'
for k in formkeys:
    print '<LI>' + k + ':' form[k].value + '</LI>'
print '</UL>'

footer()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo CGI Web
» HTML