0

So I am trying to add a value to a pre-existing row in a csv file using python. I have literally scoured the web for any websites, previous StackOverflow Questions which have the answer I am looking for. But I can't find any. So basically, I want to change a csv file from

example,example,example
example2,example2,example2

to

example,example,example,example
example2,example2,example2,example2

I don't have any code because I have no idea how I could possibly do it.

1 Answers1

0

if you want to add column to the last row only you can just append it like this

with open("file.csv","a") as csv_file:
    csv_file.write(",example2")