Python Forum
Overwrite previous live data.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Overwrite previous live data.
#1
Hi,

I am trying to output the current code, which is working ok.
But i want the output to overwrite previous data instead of append.


import requests
import csv
import time
import schedule
from time import sleep
import sys
import csv
import io
starttime=time.time()

def task():
    with io.open('C:\\Campbellsci\\LoggerNet\\CR1000_Public.dat') as f:
        reader = csv.reader(f, delimiter=',')
        
        for field in reader:
            a = (field[6])
            print(a)
            
while True:
 try:
     task()
     time.sleep(0.25 - time.time() % 0.25)
     refresh()
 except:
    pass
    time.sleep(0)
else:
 time.sleep(0)
 refresh()
Here is the output:

Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
================== RESTART: C:\Users\Makada\Desktop\cr1000.py ==================
11.38377
11.38377
11.07566
11.07566
10.79836
10.49026
10.42863
10.42863
10.15134
Reply


Messages In This Thread
Overwrite previous live data. - by Makada - Oct-30-2020, 10:38 PM
RE: Overwrite previous live data. - by snippsat - Oct-31-2020, 10:00 AM
RE: Overwrite previous live data. - by Makada - Nov-07-2020, 07:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Create simple live plot of stock data dram 2 2,910 Jan-27-2023, 04:34 AM
Last Post: CucumberNox
  Openpyxl overwrite Linechart SamLiu 0 870 Nov-26-2022, 05:44 AM
Last Post: SamLiu
  How to plot data from live datasource? Makada 14 5,853 Sep-06-2020, 07:13 PM
Last Post: Makada
  Python animate live plotting fetching data from Mysql Table dhirajm 6 3,624 Apr-24-2020, 05:07 PM
Last Post: dhirajm
  How to overwrite file SriRajesh 3 6,313 Apr-14-2020, 12:57 PM
Last Post: steve_shambles
  Pulling & Reading Date from UDF that Compare it to Live Data firebird 4 2,762 Jul-20-2019, 09:30 AM
Last Post: snippsat
  Dict overwrite previous list vincentspm 1 2,215 Mar-20-2019, 12:31 PM
Last Post: scidam
  Run function in parallel but inherite dynamic data from the previous function atizva 4 3,540 Jul-11-2018, 06:39 AM
Last Post: volcano63
  overwrite data using openpyxl BNB 0 10,575 Jun-21-2017, 11:31 AM
Last Post: BNB

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020