Logging data to CSV with python
Question: 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.


Answer: 
    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)
    

