[Tutor] accessing items in nested structure
Karl Pflästerer
sigurd at 12move.de
Mon Mar 22 11:04:50 EST 2004
On 22 Mar 2004, kevin parks <- kp8 at mac.com wrote:
> def datas(x):
> pg01 = [ { (1,0) : [8, 3, 5, 4] },
> { (7,0) : [4, 3, 2, 2] },
[...]
> { (41,1) : [2, 0, 3, 1, 6] }]
> return pg01[x]
> #
[...]
> Hi all. My data structure is getting a little complex with a list of
> dictionaries (which are made up of a tuple key and list value). Now i
Before we go into detail. Are you sure you need such a complex data
structure? Why don't you just take one dictionary and put the key/value
pairs in it? At the moment each dictionary has only one key. That's a
huge overhead.
If that is cleared it will be easier to answer your question how to
iterate over the structure.
Why do you write a function to store the structure?
Karl
--
Please do *not* send copies of replies to me.
I read the list
More information about the Tutor
mailing list