Reputation: 21
I am trying to update a log file form a python script. I have script that generate 2 variables, inside & outside, and a log file templog.csv
The CSV file is in the format date,time,inside,outside
I need to generate the date and time and then write the whole lot with commas to the file.
I have done this already as a shell script but would like to include it all in one python script.
Thanks.
Upvotes: 1
Views: 5027
Reputation: 226486
import time
import csv
row = [time.ctime(), time.time(), inside, outside]
with open('templog.csv', 'a') as f:
w = csv.writer(f)
w.writerow(row)
Upvotes: 3