Hey fellas,
I have searched for this answer for about an hour on and off and cannot find anything so sorry to have to resort to posting.
I have a list [a, b, c, d]
And I want to write it to a simple output file, but I want it to be written with a new line after each character so that it appears in the file as:
a
b
c
d
There is more going on in the program but this is the only thing I really am concerned with at the moment. It's complaining when I insert a newline character into the writeout (I assume this only applies to strings).
Here is a snipet of my code if that helps:
--------------------------------------------- (Declarations separated below)
temp = [ ]
col = int(raw_input('Please select a column (starting at 0) from your infile, %s:' % (infile)))
--------------------------------------------
for line in f:
line = line.split() #Line has been split into a list of components [a,b,c...]
temp.append(line[col]) #Write the user-specified column into the empty list, "temp"
for i in range(len(temp)): #This line basically just prints one by one
o.write(temp)