Array of dict or lists or ....?
Pat
Pat at junk.net
Tue Oct 7 22:15:54 EDT 2008
Dennis Lee Bieber wrote:
> On Mon, 06 Oct 2008 19:45:07 -0400, Pat <Pat at junk.com> declaimed the
> following in comp.lang.python:
>
>> I can't figure out how to set up a Python data structure to read in data
>> that looks something like this (albeit somewhat simplified and contrived):
>>
>>
>> States
>> Counties
>> Schools
>> Classes
>> Max Allowed Students
>> Current enrolled Students
>>
>> Nebraska, Wabash, Newville, Math, 20, 0
>> Nebraska, Wabash, Newville, Gym, 400, 0
>> Nebraska, Tingo, Newfille, Gym, 400, 0
>> Ohio, Dinger, OldSchool, English, 10, 0
>
> <snip>
>
> The structure looks more suited to a database -- maybe SQLite since
> the interface is supplied with the newer versions of Python (and
> available for older versions).
I don't understand why I need a database when it should just be a matter
of defining the data structure. I used a fictional example to make it
easier to (hopefully) convey how the data is laid out.
One of the routines in the actual program checks a few thousand
computers to verify that certain processes are running. I didn't want
to complicate my original question by going through all of the gory
details (multiple userids running many processes with some of the
processes having the same name). To save time, I fork a process for
each computer that I'm checking. It seems to me that banging away at a
database would greatly slow down the program and make the program more
complicated.
The Perl routine works fine and I'd like to emulate that behavior but
since I've just starting learning Python I don't know the syntax for
designing the data structure. I would really appreciate it if someone
could point me in the right direction.
More information about the Python-list
mailing list