[SOLVED] How to read csv data alternately every 5 seconds in python


This Content is from Stack Overflow. Question asked by nana

So I have a csv data and I want my program to read the data every 5 seconds. So between the first data and the second data there is a reading distance of 5 seconds.
Can I use time.sleep() or is there another way to do it?

data_signal = np.loadtxt(pname + fname,
for i in range(len(data_signal)
      data = data_signal[i]


for z in range(1, len(YourFileOpen)):
     with open(f'{z}.csv') as csv_file:
         csv_reader = csv.reader(csv_file, delimiter=';')
         line_count = 0

     for row in csv_reader:
         value1 = row[0]
         value2 = row[2]

after this use print and (import time) after print insert your sleep:


This Question was asked in StackOverflow by nana and Answered by MMDRZA It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?