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