I'm working on a python script that opens a logfile, writes specific information to a new csv file and then compares the time difference between each action within the log file. The problem I'm having is that I need to figure a way to add the time difference to the new csv file after it was closed during the first writing process. This is what I have so far for that part.
final_file = open('FinalLogFile.csv', 'w')
temp_logfile = csv.reader(open('tempLogFile.csv', 'rb'), delimiter="\t")
fmt = '%Y-%m-%d %H:%M:%S.%f'
row_count = 0
#find the time between each action and write it to the new file
#transfer actions from temp file to final file
for row in temp_logfile:
time = (row[0] + " " + row[1])
timestamp = strptime(time, fmt)