Hi, im quite new to python and I am trying to extract some data from a csv file and put it into a new file, this is the first line of the data:
I have managed to get it to print a new line per column, but i need all this on one line, and it needs to be in the following format:
+1 1:1 2:3 3:0 4:1 5:2 6:2 7:1 8:13 9:19 10:30 11:13: 12:10 13:20
i currently have the following code:
import csv ifile = open('trainingSet1.csv', "rb") f = open('train', "wb") reader = csv.reader(ifile) for row in reader: num = 0 for col in row: c = num, ':', col print >>f, c num += 1 ifile.close()
can anyone help?