Adding an integer and string to a list with new lines
<p>I have some code that generates a integer and a str and I can get them to append into a list but I would like them on a seperate line for each int and str. My code is as follows:</p>

<pre><code>responses = []
responses.append(respTime)
responses.append(category_repeated)
responses = [0.11700010299682617        correct     0.1000001431        correct     0.0779998302        correct]
</code></pre>

<p>I would like this so it can be opened into libreOffice calc into rows with two columns:</p>

<pre><code>0.117000 correct
0.100000 correct
</code></pre>

<p>Thanks in advance for any advice. </p>

<p>It is easier to process if you have a list of tuples:</p>

<pre><code>responses = []
responses.append((respTime, category_repeated)) # &lt;--- slight difference
responses == [(0.11700010299682617, 'correct'), (0.1000001431, 'correct')]
# responses[0] == (0.11700010299682617, 'correct')
</code></pre>

<p>Here is an example for writing a .csv file from the docs:</p>

<pre><code>import csv
with open('eggs.csv', 'wb') as csvfile:
    spamwriter = csv.writer(csvfile, delimiter=' ',
                            quotechar='|', quoting=csv.QUOTE_MINIMAL)
    spamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])
    spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
</code></pre>

python string list int rows