class documentation
Implementation of a multi-dictionary. Keys can occur multiple times.
Internally, the MultiDict is a defaultdict with list for each key that can hold multiple values.
| Method | __init__ |
Initialize the MultiDict. |
| Method | __repr__ |
Return a string representation of the MultiDict. |
| Method | __setitem__ |
Set an item in the MultiDict. |
| Method | __str__ |
Return a string representation of the MultiDict. |
| Method | get |
Get a value for a key. This returns a list of all values for the key. |
| Method | get |
Get one value for a key. If the key has multiple values, the first value is returned. |
Get a value for a key. This returns a list of all values for the key.
| Parameters | |
key:Any | The key to get the value lisz for. |
default:Any | The default value to return if the key does not exist. |
greedy:bool | If True, the value is removed from the MultiDict. This removes the key and all values. |
flatten:bool | If True, and the value is a list with only one element, the element is returned instead of the list. |
| Returns | |
Any | The value for the key. |
Get one value for a key. If the key has multiple values, the first value is returned.
| Parameters | |
key:Any | The key to get the value for. |
default:Any | The default value to return if the key does not exist. |
greedy:bool | If True, the value is removed from the MultiDict. This is only the value, not the key. The key is only removed if all values are removed. |
| Returns | |
Any | The value for the key. |