CGI getting multiple values with same name into a list

Manus Hand mjhand at
Tue May 9 18:29:34 EDT 2000

Here is how I do what you are wanting to do.

form, data = cgi.FieldStorage(), {}
for key in form.keys():
    if type(form[key]) != type([]): data[key] = form[key].value
    else: data[key] = map(lambda x: x.value, form[key])

Hope that helps,

More information about the Python-list mailing list