flattening a dict
Jeff Schwab
jeff at schwabcenter.com
Sat Feb 16 23:23:07 EST 2008
Benjamin wrote:
> How would I go about "flattening" a dict with many nested dicts
> within? The dicts might look like this:
> {"mays" : {"eggs" : "spam"},
> "jam" : {"soda" : {"love" : "dump"}},
> "lamba" : 23
> }
> I'd like it to put "/" inbetween the dicts to make it a one
> dimensional dict and look like this:
> {"mays/eggs" : "spam",
> "jam/soda/love" : "dump",
> "lamba" : 23
> }
What have you tried so far?
More information about the Python-list
mailing list