MultiDict

An ordered dictionary that can have multiple values for each key. Adds the methods getall, getone, mixed, and add to the normal dictionary interface.


Methods

f __init__(self, *args, **kw) ...

f view_list(cls, lst) ...

Create a dict that is a view on the given list

f from_fieldstorage(cls, fs) ...

Create a dict from a cgi.FieldStorage instance

f __getitem__(self, key) ...

f __setitem__(self, key, value) ...

f add(self, key, value) ...

Add the key and value, not overwriting any previous value.

f getall(self, key) ...

Return a list of all values matching the key (may be an empty list)

f getone(self, key) ...

Get one value matching the key, raising a KeyError if multiple values were found.

f mixed(self) ...

Returns a dictionary where the values are either single values, or a list of values when a key/value appears more than once in this dictionary. This is similar to the kind of dictionary often used to represent the variables in a web request.

f dict_of_lists(self) ...

Returns a dictionary where each key is associated with a list of values.

f __delitem__(self, key) ...

f has_key(self, key) ...

f __contains__(self, key) ...

f __cmp__(self, other) ...

f clear(self) ...

f copy(self) ...

f setdefault(self, key, default=None) ...

f pop(self, key, *args) ...

f popitem(self) ...

f update(self, other=None, **kwargs) ...

f __len__(self) ...

f keys(self) ...

f iterkeys(self) ...

f __iter__(self) ...

f items(self) ...

f iteritems(self) ...

f values(self) ...

f itervalues(self) ...

See the source for more information.