0

So i have this 2d array

z = [["test","dus"],["dus","ta"]]

then i want to write it to an csv files by using this python code:

with open('test.csv','w') as out:
csv_out=csv.writer(out)
csv_out.writerow(['input','output'])
for row in z:
    csv_out.writerow(row)

it successfully written it in the csv however i don't get why the results look like this:

input output

test dus

dus ta

so it create an empty list after each iteration which doesn't make sense why is this happening ? is it possible to avoid it ?

user3646742
  • 199
  • 12

0 Answers0