creating dictionarie names, using variables?
Dan Sommers
me at privacy.net
Thu Jan 12 06:33:44 EST 2006
On Wed, 11 Jan 2006 18:00:53 -0700,
"Livin" <livin at cox.net> wrote:
> Are you saying that each child dictionary actually has its own 'key',
> not just the items within it?
I don't quite understand "its own 'key'."
There is a main dictionary. The keys come from replacing spaces with
plusses in item[5]. The values are another dictionary. The keys of
this other dictionary are the strings 'Group', 'Status', etc. The
values of this other dictionary are item[2], item[3], etc.
> The goal is to create a dictionary with many dictionaries in it.
> - each child dictionary will hold a single 'device' and its related
> attributes.
Agreed. Call this the parent dictionary. I called it devDict.
> - I want to name the child dictionaries the same as their device name
> so it is easy to call them from within the dictionary.
The names of the child dictionaries exist as keys in the parend
dictionary.
> - also, they dictionary will be dynamic, thus the # of devices is
> always changing so they need to be created on-the-fly.
Yes, child dictionaries can be created on the fly, and be manipulated
and managed within the parent dictionary.
HTH,
Dan
--
Dan Sommers
<http://www.tombstonezero.net/dan/>
More information about the Python-list
mailing list