Home > Software design >  Read csv in real time with python
Read csv in real time with python

Time:08-17

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?

CodePudding user response:

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
  • Related