Multidict¶
Description:
- Dict-like collection of key-value pairs where key might occur more than once in the container. It behaves mostly like a regular dict but it may have several values for the same key and preserves insertion ordering.
Resources:
Example 1¶
Create a mutable mapping
In [ ]:
Copied!
from multidict import CIMultiDict
dct = CIMultiDict(key='val')
'Key' in dct
from multidict import CIMultiDict
dct = CIMultiDict(key='val')
'Key' in dct
Example 2¶
Create a dict with repeating key values
In [ ]:
Copied!
from multidict import MultiDict
new_dct = MultiDict([('a', 1), ('b', 2), ('b', 3),
('c', 5), ('d', 4), ('c', 7)])
new_dct
from multidict import MultiDict
new_dct = MultiDict([('a', 1), ('b', 2), ('b', 3),
('c', 5), ('d', 4), ('c', 7)])
new_dct