On Thu, Nov 4, 2010 at 11:48 AM, macm <moura.ma...@gmail.com> wrote:
> Hi Folks
>
> How convert list to nested dictionary?
>
>>>> l
> ['k1', 'k2', 'k3', 'k4', 'k5']
>>>> result
> {'k1': {'k2': {'k3': {'k4': {'k5': {}}}}}}

We don't do homework.
Hint: Iterate through the list in reverse order, building up your
result. Using reduce() is one option.

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to