CGI Web Python Tutorial

import cgi
form = cgi.FieldStorage()
if not form:
    print "Content-Type: text/html"
    print
    print """
    
    
    
    
    """
elif form.has_key("filename"):
    item = form["filename"]
    if item.file:
        data = item.file.read()
        print "Content-Type: text/html"
        print
        print cgi.escape(data)