Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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+'
')
    i+=1
Source by fredgibbs.net #
 
PREVIOUS NEXT
Tagged: #replace #word #csv #file #python
ADD COMMENT
Topic
Name
8+6 =