generate functionTue, 04 Apr 2023

Guardar eventos en archivo csv

def save_events(events, filename): """ Save events to a csv file Args: events: a list of events filename: name of a file to save """ with open(filename, 'w') as f: writer = csv.writer(f) header = [ 'time', 'event_type', 'event_name', 'event_value', 'interval' ] writer.writerow(header) for event in events: writer.writerow(event)

Questions about programming?Chat with your personal AI assistant