[Tutor] checking variable types
pythonTutor at venix.com
Fri Apr 2 08:51:00 EST 2004
If you are using the cgi module and its FieldStorage class, the getlist
method will ALWAYS return a list, even for a single selection.
I do not remember which version of Python added that method, but if you
are using the current version of Python, I think that is the best way to
getfirst is the method to use if you NEVER want a list. It discards the
On Mon, 2004-03-22 at 10:03, Marie Robichon wrote:
> I have a mutliple select box in html which (unfortunately) returns a list
> if someone makes a multiple selection but returns a string if someone
> selects one item only.
> How in my python script do I test whether it is a list or a string before I
> do my processing ?
> Thanks in advance from a newbie,
> Tutor maillist - Tutor at python.org
1 Court Street, Suite 378
Lebanon, NH 03766-1358
More information about the Tutor