Output
: HTML « CGI Web « Python Tutorial






import sys
import cgi
import traceback
print "Content-type: text/html"
print
sys.stderr = sys.stdout
try:
    n = 10
    while n>0:
        print "<hr>"
        print 10/(n-1) # This will cause an error when n=1
        n = n - 1
except:
    print "\n\n<PRE>"
    traceback.print_exc()








22.2.HTML
22.2.1.Output html tags
22.2.2.Output
22.2.3.Output a HTML page