how to replace a word in csv file using python

Do you want to know the information regarding “how to replace a word in csv file using python”. If yes, you’re in the correct article.

how to replace a word in csv file using python

import csv

inputfile = csv.reader(open('civil-war-battles.csv','r'))
outputfile = open('placelist.txt','w')

i=0

for row in inputfile:
    place = row[2].replace(' ,',',')
    print place
    outputfile.write(place+'n')
    i+=1

Final Thoughts

I hope this post helps you to know about “how to replace a word in csv file using python”. If you have any questions regarding this post please let us know via the comment section. Share this tutorial with your friends and family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment