Building and Transvering multi-level dictionaries

Alex alex at somewhere.round.here
Mon Mar 20 21:35:47 EST 2000


> #add a key and setup for a sub-dictionary
> if(D.has_key('a') == 0)
>     D['a'] = {}

Another way to do this is with the dictionary's get method:

D['a'] = D.get ('a', {})

Alex.



More information about the Python-list mailing list