Skip to content

Instantly share code, notes, and snippets.

@yyl
Created October 2, 2012 15:00
Show Gist options
  • Save yyl/3819836 to your computer and use it in GitHub Desktop.
Save yyl/3819836 to your computer and use it in GitHub Desktop.
cgi python
#!/usr/bin/python
# Import modules for CGI handling
import cgi, cgitb
# Create instance of FieldStorage
form = cgi.FieldStorage()
print "Content-type:text/html\r\n\r\n"
print "# of data fields: %s" % len(form)
# Get data from fields
for key in form.keys():
print "key: %s - value: %s " % (key, form.getvalue(key))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment