title: How do I write data to csv file in columns and rows from a list in python?
body: <p>I have a list of lists and I want to write them in a csv file with columns and rows. I have tried to use <code>writerows</code> but it isn't what I want. An example of my list is the following:</p>
  <pre><code>[[1, 2], [2, 3], [4, 5]]
  </code></pre>
  <p>With this:</p>
  <pre><code>example = csv.writer(open('test.csv', 'wb'), delimiter=' ')
  example.writerows([[1, 2], [2, 3], [4, 5]])
  </code></pre>
  <p>I get <code>1 2</code> in a cell, <code>2 3</code> in a cell, etc. And not <code>1</code> in a cell and <code>2</code> in the next cell.</p>
  <p>I need to write this example list to a file so when I open it with Excel every element is in its own cell.</p>
  <p>My output should be like this:</p>
  <pre><code>1 2
  2 3
  4 5
  </code></pre>
  <p>Each element in a different cell.</p>