Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Better than nested? Nah. solution in Clear category for The Flat Dictionary by veky
def flatten(D, path=[]):
if not D: D = ""
if isinstance(D, dict):
res = {}
for key, val in D.items(): res.update(flatten(val, path + [key]))
return res
if isinstance(D, str): return {"/".join(path): D}
Nov. 1, 2017
Comments: