Hello
I need some help. I am working with a program that dumps a continuous file
while the program is running. This file contains loads of information and I am
only looking for a small amount of the data.
I have written the program below:
import re,os
fopen = open("c:\\data.txt",'r')
lines = fopen.readlines()
fopen.close()
def parser():
ul = r"dataRate=(\w+)"
count = 0
for line in lines:
count = count + 1
match1 = re.search(ul,line)
if match1:
print match1.group(1)
parser()
data.txt file content
dataRate=104
dataRate=107
dataRate=103
dataRate=102
this was an example the file contains much more.
This works but it doesn't show me the results real time. I would like this
program to keep on running while the program is running once the program is
closed and the file stops growing it should exit. I was checking with google
and came accross a command used in UNIX called the tail command.
May be someone can help me to achieve the same result with modifying the above
code? Also the file could be up to 200 MB long.
Many thanks for your kind help. /Ray
---------------------------------
Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now._______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor