Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Recursion is easy solution in Clear category for The Flat Dictionary by Tairraos
def flatten(dictionary):
result = {}
flat = lambda d: [
result.update({i: d[i]}) if type(d[i]) == str else
result.update({i: ""}) if d[i] == {} else
flat({i + "/" + k: d[i][k] for k in d[i]}) for i in d
]
flat(dictionary)
return result
May 23, 2018