MultiDict.setlist(key, new_list)[source]

Remove the old values for a key and add new ones. Note that the list you pass the values in will be shallow-copied before it is inserted in the dictionary.

>>> d = MultiDict()
>>> d.setlist('foo', ['1', '2'])
>>> d['foo']
>>> d.getlist('foo')
['1', '2']
  • key – The key for which the values are set.
  • new_list – An iterable with the new values for the key. Old values are removed first.