Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for The Flat Dictionary by thealfest1
def flatten(dictionary, path = ''):
d = {}
for key, val in dictionary.items():
key2 = path + key
if type(val) is dict and val:
d.update(flatten(val, key2 + '/'))
else:
d[key2] = val if val else ''
return d
Feb. 7, 2019
Comments: