Lad wrote:
> I have a list
> L={}

This IS a dictionary, not a list.

> Now I can assign the value
> L['a']=1
> and I have
> L={'a': 1}
> 
> but I would like to have a dictionary like this
> L={'a': {'b':2}}

You need to initialise L['a'] first, before referencing L['a']['b']

So, you need to call first:
L['a'] = {}

Then you can write:
L['a']['b'] = 2

Tomasz Lisowski
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to