Name
getlist
Synopsis
f
.getlist(key
)
When
f
.has_key(
key
)
,
and
f
[
key
].value
is a single value, not a list of values, getlist
returns
[
f
[
key
].value]
,
i.e., a list whose only item is
f
[
key
].value
.
When
f
.has_key(
key
)
,
and
f
[
key
].value
is a list of values, getlist
returns
f
[
key
].value
.
When key
is not a key in
f
, getlist
returns the
empty list []
.
Use getlist
when you know that there can be more
than one input field named key
in the form
from which your script’s input comes.
getlist
was introduced in Python 2.2, so
don’t use it if your script must remain compatible
with older versions of Python.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.