I am working with a simple csv file and want to know how to update the values contained in a specific cell on each row using data my script has generated.
column1, column2, colum3, column4,
bob, 20, blue, hammer
jane, 30, red, pencil
chris, 40, green, ruler
Then:
new_colour = [pink, yellow, black]
Is there a way to take the list <new_colour> and write each list item into the values under colum3 within the csv file? To have it end up like below:
column1, column2, colum3, column4,
bob, 20, pink, hammer
jane, 30, yellow, pencil
chris, 40, black, ruler
Thank you
XXX.csv.bkupbefore writing the new file. If there are other processes simultaneously accessing the CSV while you change it, save the new file asXXX.csv.inprogresstill it is completely written then rename it when complete so everyone gets a consistent view.