Nested Dictionaries
emile at fenx.com
emile at fenx.com
Thu May 18 15:47:46 EDT 2000
outer['12345']['state']
Emile van Sebille
emile at fenx.com
Chris Lada <chris.lada at westgroup.com> wrote in message
news:<392446c9 at wwwproxy3.westgroup.com>...
> Is there some where of directly accessing information in a dictionary which
> occurs as part of another dictionary i.e.:
>
> inner = {'city':'This City','state':'This State'}
> outer = {'12345':inner}
>
> In order to access the 'city' information in the 12345 dictionary entry, I
> do the following:
>
> temp = outer['12345'] # yields the outer dictionary entry with the key
> '12345'
>
> tempCity = temp['city'] # yields the city value of the inner dictionary of
> the
> # outer dictionary entry with the key
> '12345'
>
> Is there an easier or more direct way of doing this ?
>
> Thanks,
> Chris
>
>
>
>
>
>
>
>
>
> --
> http://www.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list