Good day,
I tried to change a word in a certain column,using index, in a csv file ,but it is not changed.
My code that I tried to use:
import csv
with open('INPUT.CSV', 'r') as file1, open('OUTPUT.csv','w',newline='') as file2:
reader = csv.reader(file1, delimiter=',')
writer = csv.writer(outfile, delimiter=',')
for row in reader:
row[0].replace('word','changed word')# I want to replace in first column=row[0] 'word' with 'changed word'
writer.writerow(row)
The output file is same with the input, no changed.
Can someboby help me in this way?Many thanks in advance!