0

I'm trying to add a row to an existing .csv file (rows have the same format).

Here is my code:

sample = {"Language": "Francais","Description": "question sur les cost-centers"}

to_add = [sample['Language'], sample['Description']]
with open('train_tickets.csv', mode='a', newline='') as f:
    w = csv.writer(f, delimiter=';')
    w.writerow(to_add)

The output (see image below) writes on the same line:

Last Row of csv file

While I would like them to be appended to a new row:

Intended Result

Does anyone know what's wrong in my code? Thanks.

0 Answers0