1

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.

1 Answer 1

3
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)
Sign up to request clarification or add additional context in comments.

1 Comment

Consider using some sort of implementation of python logging official library

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.