I have this example code of a program I am writing at the place I work as a 'time clock' of sorts. I want to come in, run the program and clock in. When I clock in, I want to write this to a csv file so I can send it to payroll and get paid. The thing is I am unsure as to how to write this code to update to the next line. Every time I write to the csv, it overwrites the current line in the file. Any ideas?
writer = csv.writer(open('test.csv', 'w'), delimiter=' ') date = str(today.month) + "/" + str(today.day) + "/" + str(today.year) writer.writerow(date)
I understand that it's not the most efficient code, especially the 'date' line, but I just want it to work, I'll make it look nice later.
Also, I don't want to read the file, then rewrite it (as was suggested to me in another forum) because I will be keeping a record of all of my dates while working here, and that just doesn't seem efficient to me. Thanks!