Building and Transvering multi-level dictionaries

Alex alex at somewhere.round.here
Tue Mar 21 03:35:47 CET 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