Read csv in real time with python

391 Views Asked by At

I have a csv file that is writing some information on real-time with cicflowmeter. Is there a way to catch every new row in the time that it is writed with a python script?

1

There are 1 best solutions below

0
Michael M. On BEST ANSWER

This problem can be solved without any python code. Just run something like tail -n0 -f logfile.csv | python3 program.py and have your program read from stdin like this:

import sys

for line in sys.stdin:
    # do something