On 20/02/15 17:56, Chris Stinemetz wrote:
I am getting closer. I think I have figured out the logic. I just have a
quick question. How do you access key:values in a nested dictionary?

MOL02997_C': [{'2': '0', '7': '0', '8': '0', '9': '0'}]}

say I want to access the key:value 8:0

print dict['MOL02997_C']['8'] doesn't seem to work.

Look closer. The inner dictionary is inside a list [...].

try

print dict['MOL02997_C'][0]['8']


If that works then try to figure out where the extra list
is coming from and eliminate it.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to