flatdict

emlib.iterlib.flatdict(d)[source]

Given a dictionary, return a flat list where keys and values are interleaved.

This is similar to doing flattened(d.items())

Return type:

list

Example

>>> d = {'a': 1, 'b': 2, 'c': 3}
>>> flatdict(d)
['a', 1, 'b', 2, 'c', 3]