Aug-18-2022, 10:36 AM
(Aug-17-2022, 09:18 PM)deanhystad Wrote: Don't use utf-8 encoding. It is too restrictive. You should probably specify a dialect.
Thanks for reply. I have fixed it partly by doing this. I was not encoding the first write as the others below pointed out. I am now doing this.
with open(full_report_path, 'w',encoding='utf-8') as f: writer = csv.writer(f) writer.writerow(['High alerts found', len(list_of_high_alerts)]) writer.writerow(['Medium alerts found', len(list_of_medium_alerts)]) writer.writerow(report_column_names) # Sets the column order with open(full_report_path, 'a+', encoding='utf-8', newline='') as output_file: dict_writer = csv.DictWriter(output_file, report_column_order) dict_writer.writerows(computer_list)This works fine for Numbers, but Excel is still an issue. Can you please explain a bit more about dialects?