Spaces:
Sleeping
Sleeping
File size: 951 Bytes
2c8f0e3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import csv
import datetime
def list_at_index(extracted_list, index):
value_at_index = extracted_list[index]
return value_at_index
def list_at_index_0(extracted_list):
value_at_index = extracted_list[0]
return value_at_index
def list_at_index_1(extracted_list):
value_at_index = extracted_list[1]
return value_at_index
def logger(log_filename, log_data, response):
with open(log_filename, mode='a', newline='') as log_file:
log_writer = csv.writer(log_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
# Get the current date and time
current_datetime = datetime.datetime.now()
date_str = current_datetime.strftime("%Y-%m-%d")
time_str = current_datetime.strftime("%H:%M:%S")
log_data.append(date_str)
log_data.append(time_str)
log_data.append(response)
# Write the log data to the CSV file
log_writer.writerow(log_data)
|