* 'struct-like' list *

Ernesto erniedude at gmail.com
Mon Feb 6 12:03:09 EST 2006


I'm still fairly new to python, so I need some guidance here...

I have a text file with lots of data.  I only need some of the data.  I
want to put the useful data into an [array of] struct-like
mechanism(s).  The text file looks something like this:

[BUNCH OF NOT-USEFUL DATA....]

Name:  David
Age: 108   Birthday: 061095   SocialSecurity: 476892771999

[MORE USELESS DATA....]

Name........

I would like to have an array of "structs."  Each struct has

struct Person{
    string Name;
    int Age;
    int Birhtday;
    int SS;
}

I want to go through the file, filling up my list of structs.

My problems are:

1.  How to search for the keywords "Name:", "Age:", etc. in the file...
2.  How to implement some organized "list of lists" for the data
structure.

Any help is much appreciated.




More information about the Python-list mailing list