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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access