Re: * 'struct-like' list *

2006-02-10 Thread Bengt Richter
On Tue, 07 Feb 2006 18:10:05 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: [...] >< ernesto.py >- [...] Just noticed: >substrings = line.split() >if substrings and isinstance(substrings, list) and substrings[0] == > 'Name:

Re: * 'struct-like' list *

2006-02-07 Thread Ernesto
Thanks tons ! -- http://mail.python.org/mailman/listinfo/python-list

Re: * 'struct-like' list *

2006-02-07 Thread Bengt Richter
On 6 Feb 2006 09:03:09 -0800, "Ernesto" <[EMAIL PROTECTED]> wrote: >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 l

Re: * 'struct-like' list *

2006-02-07 Thread Ernesto
Thanks ! -- http://mail.python.org/mailman/listinfo/python-list

Re: * 'struct-like' list *

2006-02-07 Thread Schüle Daniel
Ernesto wrote: > Thanks for the approach. I decided to use regular expressions. I'm > going by the code you posted (below). I replaced the line re.findall > line with my file handle read( ) like this: > > print re.findall(pattern, myFileHandle.read()) > > This prints out only brackets []. Is

Re: * 'struct-like' list *

2006-02-07 Thread Ernesto
Thanks for the approach. I decided to use regular expressions. I'm going by the code you posted (below). I replaced the line re.findall line with my file handle read( ) like this: print re.findall(pattern, myFileHandle.read()) This prints out only brackets []. Is a 're.compile' perhaps necess

Re: * 'struct-like' list *

2006-02-06 Thread Raymond Hettinger
[Ernesto] > 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 DAT

Re: * 'struct-like' list *

2006-02-06 Thread Paul McGuire
"Ernesto" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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

Re: * 'struct-like' list *

2006-02-06 Thread Schüle Daniel
> I would like to have an array of "structs." Each struct has > > struct Person{ > string Name; > int Age; > int Birhtday; > int SS; > } the easiest way would be class Person: pass john = Person() david = Person() john.name = "John Brown" john.age = 35 etc think of

Re: * 'struct-like' list *

2006-02-06 Thread Rene Pijlman
Ernesto: >1. How to search for the keywords "Name:", "Age:", etc. in the file... You could use regular expression matching: http://www.python.org/doc/lib/module-re.html Or plain string searches: http://www.python.org/dev/doc/devel/lib/string-methods.html >2. How to implement some organized "li