extract certain values from file with re

Bernard bernard.chhun at gmail.com
Fri Oct 6 14:11:11 CEST 2006


Hi Fabian,
I'm still a youngster in Python but I think I can help with the
"extracting data from the log file" part. As I'm seeing it right now,
the only character separating the numbers below is the space character.
You could try splitting all the lines by that character starting from
the NO Column. The starting point of the split function could easily be
defined by regexes. Using this regex : \s+\d+\s{1,2}[\d\w\.-]*\s+ ... I
was able to extract the 2 first columns of every row. And since the
while document is structured like a table, you could define a
particular index for each of the columns of the split result.

I sincerely hope this can help in any way :)




More information about the Python-list mailing list