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 frbrgeorge
def flatten(dictionary):
def flat(d, p=""):
for k,v in d.items():
if v=={}: v=""
if type(v) is dict:
yield from flat(v,f"{p}{k}/")
else:
yield f"{p}{k}", v
return dict(flat(dictionary))
Aug. 5, 2019
Comments: