I have a text file in which each row has multiple words (which I want to consider as columns). Now I want to read all the data from this text file and create a csv file with rows and columns. I am written the code till here -
import csv
f=open("text.txt", "r")
reader=csv.reader(f)
offile=open("output.csv","wb")
writer=csv.writer(offile,delimiter='\t',quotechar='"',quoting=csv.QUOTE_ALL)
for row in reader:
........
f.close()
offile.close()
I am not able to understand how to divide each row into columns and write this columns and rows back while writing a csv file? I am a newbie to python, so a good example I will be very greatful.
Thanks