Staging
v0.5.1
https://github.com/python/cpython
Revision d0b6d9d892d50301bd17101f3880c17431b104ae authored by Andrew M. Kuchling on 04 July 2004, 15:35:00 UTC, committed by Andrew M. Kuchling on 04 July 2004, 15:35:00 UTC
1 parent 0ea241e
Raw File
Tip revision: d0b6d9d892d50301bd17101f3880c17431b104ae authored by Andrew M. Kuchling on 04 July 2004, 15:35:00 UTC
More additions
Tip revision: d0b6d9d
cgi2.py
#!/usr/local/bin/python

"""CGI test 2 - basic use of cgi module."""

import cgitb; cgitb.enable()

import cgi

def main():
    form = cgi.FieldStorage()
    print "Content-type: text/html"
    print
    if not form:
        print "<h1>No Form Keys</h1>"
    else:
        print "<h1>Form Keys</h1>"
        for key in form.keys():
            value = form[key].value
            print "<p>", cgi.escape(key), ":", cgi.escape(value)

if __name__ == "__main__":
    main()
back to top