I am using Python (Raspberry Pi) to edit a CSV file. I open the file with the "append" tag and add a line. After that I check the size of the fil. If the file size is too big, I want to delete the first row of data (there is a headers row). Every example I see just skips the row and the writes all the other rows to a different CSV file. I do not want to have to create a new CSV file...I just want to delete the first row in the current file and save it.
import csv
def write_csv(datalist):
with open("CSVfile",'a') as f:
writer = csv.writer(f, delimiter=',' ,quoting=csv.QUOTE_NONE)
writer.writerow(datalist)
while os.path.getsize("CSVfile") > 100000:
****DELETE FIRST ROW OF DATA FROM CSV FILE****
writelinefor thecsv.writerobject.writerow. Thanks.