[Tutor] Passing data from html to py

jfouhy at paradise.net.nz jfouhy at paradise.net.nz
Thu Mar 24 01:14:18 CET 2005

Quoting Vicki Stanfield <vicki at stanfield.net>:

> I need something more like this:
> First Name: Vicki
> Last Name: Stanfield
> etc.....

Instead of just printing form, try this:

for key in form:
    print '%s: %s' % (key, form[key].value)

Basically, a FieldStorage object is organised as a dictionary, where the keys
are the names of the HTML form elements, and the values are MiniFieldStorage
objects.  To get the actual form data, you look at the .value attribute.


More information about the Tutor mailing list