So, I'm trying to use the csv module in Python to add data to existing rows and columns, but only for specific columns of each row. Therefore, for example, we can say that my existing csv file has the following:
id, name, city, age
1, Ed,, 34
2, Pat,, 23
So basically, the city of each person is missing, so I would like to update each row with this city. However, the writerow method seems to replace existing data in the csv file. Editing an open file in append mode simply adds data to a new line. Is there a way to skip existing data and add a city only on each row?
thank
source
share