getfirst and re

Carsten Haese carsten.haese at
Wed Jan 6 20:09:38 CET 2010

Victor Subervi wrote:
> I have an automatically generated HTML form from which I need to extract
> data to the script which this form calls (to which the information is
> sent).

Ideally, the script that receives the submitted fields should know how
the form was generated, so it knows what fields to expect. Failing that,
 you should realize that getfirst() is not the only way to access the
contents of a cgi.FieldStorage object.

If you need to know the values of all fields whose names obey a certain
pattern, I recommend you start with a list of all field names in the
FieldStorage object and pick out the ones whose names obey that pattern.
To get the list of field names, you should consider using the .keys()
method of the FieldStorage object.


More information about the Python-list mailing list