I have multiple lines of texts in a text file that look similar to this:
2012-03-16 13:47:30.465 -0400 START Running Lab.script 19 on_the
I want to be able to convert this text file into csv. I've already done that using this code:
fin = csv.reader(open('LogFile.txt', 'rb'), delimiter='\t')
fout = open('newLogFile.csv', 'w')
for row in fin:
fout.write(','.join(row) + '\n')
But now, my issue is that I need to be able to add a "," after the spaces in this part of the line:
2012-03-16 13:47:30.465 -0400
I'm not sure how to do it, I've tried using split(), to split the current row/position but it didn't work. Any suggestions would be very helpful.
Thank you