File: class/Extras/Code/Internet/cgi-bin/cgi101.py

#!/usr/bin/python3
import cgi
form = cgi.FieldStorage()                 # parse form data
print('Content-type: text/html\n')        # hdr plus blank line
print('<title>Reply Page</title>')        # html reply page
if not 'user' in form:
    print('<h1>Who are you?</h1>')
else:
    print('<h1>Hello <i>%s</i>!</h1>' % cgi.escape(form['user'].value))



[Home page] Books Code Blog Python Author Train Find ©M.Lutz