0

I have a problem with creating a .csv file that takes data from multiple lists. Those lists are created from another files, where I search for items that are meaningful for me, i.e. file name, function name etc. My code should is executed in a loop for all files in a work folder:

def save_to_csv_file():
rows = zip(list_name, list_func_name, list_func_return_type_combined, list_func_arg_combined, list_func_object_type)
with open(current_directory + r"\Zadanie\test_csv_2.csv", "w+") as f:
    writer = csv.writer(f, delimiter=";")
    writer.writerow(header_list)
    for row in rows:
        writer.writerow(row)

This code creates a .csv file like this: enter image description here

But after saving data from file Acc.d_prec it overwrites it in second passing of the loop with data from file Adc_Irq.d_prec. And my desired output should look like this:

enter image description here

What changes should I make to achive that?

  • 1
    Welcome to Stack Overflow. [Please don't post screenshots of text](https://meta.stackoverflow.com/a/285557/354577). They can't be searched or copied, or even consumed by users of adaptive technologies like screen readers. Instead, paste the code as text directly into your question. If you select it and click the `{}` button or Ctrl+K the code block will be indented by four spaces, which will cause it to be rendered as code. – ChrisGPT was on strike Dec 28 '22 at 18:49

0 Answers0