Extracting values from text file

Preben Randhol randhol+valid_for_reply_from_news at pvv.org
Sat Jun 17 17:25:43 EDT 2006


On Sat, 17 Jun 2006 14:20:44 +0200
Mirco Wahab <wahab at chemie.uni-halle.de> wrote:

> Thus spoke Mirco Wahab (on 2006-06-16 21:21):
> 
> > I used your example just to try that in python
> > (i have to improve my python skills), but waved
> > the white flag after realizing that there's no
> > easy string/var-into-string interpolation.
> 
> I did another try on it, using all my Python
> resources available (and several cups of coffee)
> ;-)
> 
> This scans your text for rules provided
> and extracts values and variable names
> and prints them at the end.
> 
> I had some issues with python then:
> - no comment # after line continuation \\
> - regular expressions **** **** (as I said before)

Thanks! The code is a very good starting point for me! I already
managed to change it and I see I need to make it a bit more robust.

And the next challange I have is to extract n values from one line. I
mean:

   23 Apples 234 Lemons 4 Eggs

for example.

Again thanks. And thanks to all others for the suggestions. I have
looked at all and learned a lot of python. I probably will end up with
a mixture of several approaches. 

Preben



More information about the Python-list mailing list