Nested Dictionaries
Chris Lada
chris.lada at westgroup.com
Thu May 18 15:42:04 EDT 2000
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
More information about the Python-list
mailing list