Python: Simple file formating problem
<p>I'm using the code below to to write to a file but at the moment it writes everything onto a new line. </p>

<pre><code>import csv
antigens = csv.reader(open('PAD_n1372.csv'), delimiter=',')

lista = []
pad_file = open('pad.txt','w')

for i in antigens:
    lista.append(i[16])
    lista.append(i[21])
    lista.append(i[0])

for k in lista:
    pad_file.write(k+',')
    pad_file.write('\n')
</code></pre>

<p>If say my "lista" looks like</p>

<pre><code>[['apple','car','red'],['orange','boat','black']]
</code></pre>

<p>I would like the output in my text file to be:</p>

<pre><code>apple,car,red
orange,boat,black
</code></pre>

<p>I know my new line character is in the wrong place but I do now know where to place it, also how would I remove the comma from the end of each line?</p>

<hr>

<p>EDIT</p>

<p>Sorry my "lista" looks like</p>

<p>['apple','car','red','orange','boat','black']</p>
