flattendict#
- flattendict(nesteddict, sep=None, _prefix=None)[source]#
Flatten nested dictionary
- Parameters:
Example:
>>> sc.flattendict({'a':{'b':1,'c':{'d':2,'e':3}}}) {('a', 'b'): 1, ('a', 'c', 'd'): 2, ('a', 'c', 'e'): 3} >>> sc.flattendict({'a':{'b':1,'c':{'d':2,'e':3}}}, sep='_') {'a_b': 1, 'a_c_d': 2, 'a_c_e': 3}
- Parameters:
- Returns:
A flat dictionary where no values are dicts
New in version 2.0.0: handle non-string keys.