P
Przemyslaw Bak
Hello,
I many files with log data. The structure of the file is quite
inconvenience and similar to the following example:
Data1
ValueA
Data2
ValueB
Data3
ValueC
....
To get the values I need to find Data* and then get to the next line.
I tried to use fileinput.input :
....
for line in fileinput.input(filename):
if line.find("Data2") >= 0:
(now what ?)
So I can find the requested line (Data2) but how to get value from the
next line ?
Is the fileinput.input the most convenient for this type of task ?
Maybe
readline or readlines would be better ?
What can you recommend ?
Regards
I many files with log data. The structure of the file is quite
inconvenience and similar to the following example:
Data1
ValueA
Data2
ValueB
Data3
ValueC
....
To get the values I need to find Data* and then get to the next line.
I tried to use fileinput.input :
....
for line in fileinput.input(filename):
if line.find("Data2") >= 0:
(now what ?)
So I can find the requested line (Data2) but how to get value from the
next line ?
Is the fileinput.input the most convenient for this type of task ?
Maybe
readline or readlines would be better ?
What can you recommend ?
Regards