bandicoot.utils.
flatten
(d, parent_key='', separator='__')¶Flatten a nested dictionary.
Parameters: |
|
---|
Examples
>>> d = {'alpha': 1, 'beta': {'a': 10, 'b': 42}}
>>> flatten(d) == {'alpha': 1, 'beta_a': 10, 'beta_b': 42}
True
>>> flatten(d, separator='.') == {'alpha': 1, 'beta.a': 10, 'beta.b': 42}
True