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:
Thanks tons !
--
http://mail.python.org/mailman/listinfo/python-list
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
Thanks !
--
http://mail.python.org/mailman/listinfo/python-list
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
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
[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
"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
> 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
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
10 matches
Mail list logo