Building and Transvering multi-level dictionaries
Alex
alex at somewhere.round.here
Mon Mar 20 21:35:47 EST 2000
More information about the Python-list mailing list
Mon Mar 20 21:35:47 EST 2000
- Previous message (by thread): Building and Transvering multi-level dictionaries
- Next message (by thread): Building and Transvering multi-level dictionaries
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> #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.
- Previous message (by thread): Building and Transvering multi-level dictionaries
- Next message (by thread): Building and Transvering multi-level dictionaries
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list