Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Python :: werkzeug.datastructures.filestorage to numpy 
Python :: pandas select by column value 
Python :: python requirments.txt 
Python :: thousands separator python 
Python :: random gen in python 
Python :: height width image opencv 
Python :: print type of exception python 
Python :: how to get latitude and longitude from address in python 
Python :: pandas columns starting with 
Python :: python split path at level 
Python :: how to permanently store data in python 
Python :: python random randint except a number 
Python :: df.drop index 
Python :: no python 3.10 installation was detected 
Python :: yield godot 
Python :: average value of list elements in python 
Python :: .fill pygame 
Python :: discord.py commands not working 
Python :: get time taken to execute python script 
Python :: string of numbers to list of integers python 
Python :: spacy stopwords 
Python :: pygame fullscreen 
Python :: how to find runner up score in python 
Python :: run JupyterLab 
Python :: how to get all links text from a website python beautifulsoup 
Python :: argparse mutually exclusive 
Python :: get sheet names using pandas 
Python :: converting a csv into python list 
Python :: add authorization header in python requests 
Python :: tkinter labelframe 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =