Python Twitter -- let's say I have a list and I want to convert that list to a Python dict with subkeys.
For example a list: ["og","image","width",1200]
I want to create a dict like:
d['og']['image']['width'] = 1200
Is there a glamourous way to do this?
Conversation
Replying to
Does being a one-liner make it glamorous?
makeDict = lambda x: x[0] if len(x) == 1 else { x[0]: makeDict(x[1:]) }
1
4

