multi dimensional dictionary
Gary Herron
gherron at islandtraining.com
Wed May 28 01:54:59 EDT 2008
Alok Kumar wrote:
> Dear All,
>
> I am using dictionary for filling my xpath parsed data.
>
> I wanted to use in the following manner.
>
> mydict[index] ["key1"] ["key2"] #Can someone help me with right
> declaration.
>
> So that I can fill my XML xpath parsed data
>
> mydict[0] ["person"] ["setTime"] = "12:09:30"
> mydict[0] ["person"] ["clrTime"] = "22:09:30"
That kind of thing can be done, but there's a better way perhaps:
Create keys for a single level dictionary which are tuples composed of
the sequence of keys you would have used in your multidimensional
dictionary.
mydict[(0,"person","setTime")] = "12:09:30"
mydict[(0,"person","clrTime")] = "22:09:30"
Would that work for you?
Gary Herron
>
> Can someone help me with right declaration usages. Your help will be
> highly appreciated.
>
> Regards
> Alok
> ------------------------------------------------------------------------
>
> --
> http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list