Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Just simple flatten solution in Clear category for The Flat Dictionary by obone
def flatten(dictionary):
a = {}
for k, v in dictionary.items():
if v == {}:
a.setdefault(k, "")
elif type(v) == type({}):
a.update({k + '/' + kk : vv for kk, vv in flatten(v).items()})
else:
a.setdefault(k, v)
return a
June 16, 2019
Comments: