AnsweredAssumed Answered

Iteration through Dictionaries with Lists/Tuples as stored values

Question asked by octaffle on May 18, 2015
Latest reply on May 19, 2015 by recurvata

I currently have a nested cursor that I need to convert to one Cursor and one dictionary (or series of dictionaries) to improve performance and get a more desirable output.  I am a novice at Python coding and I am trying to understand Dictionaries.

 

I found that I can store a list as a dictionary value and I can call the individual entry in the value list.  For example, if D is my dictionary with keys key1 through key15 and each key is associated with a list or tuple of 5 entries for its corresponding value.  (key12 : [Name, 10, 25, 0, ABCD]).  Maybe that notation isn't 100% correct but you get the idea, hopefully.

 

I can call the individual entry in the list by D["key12"][4] which will return ABCD.

 

I have found problems when trying to iterate through these kinds of dictionaries though.  Is there a way to access the individual entries in the list/tuple during iteration or am I better off with 5 different dictionaries--one for each category in the list?

 

I actually have to step away from the computer so it may be a bit before I can get back to answer any questions.  I apologize.

 

Edit: Grammar.

Outcomes