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
This Tweet was deleted by the Tweet author. Learn more
Replying to
The other issue is that the list could be an arbritary length but the last element is always the value for all the nested keys. But that's a helpful start!
1
This Tweet was deleted by the Tweet author. Learn more
This Tweet was deleted by the Tweet author. Learn more
Replying to
This is actually the most elegant answer I've seen after reviewing a few stack overflow articles. Really nice job here.
