title: Python: how to write a list of lists to a text file so sub items appear in new lines?
body: <p>I am new to programming and Python and need to write a script so I can output data to Excel. For this purpose I am currently writing to a CSV. </p>
  
  <p>However, I have a requirement to show this data so it is readable and am not sure how to achieve this.</p>
  
  <p>I have a matrix of data</p>
  
  <pre><code>[
   ['FileName', 'File1', 'File2'], 
   ['Count', '1643', '1646'], 
   ['SomeNumbers', ['-15,51,-58,17'], ['-15,51,-58,17']],  
   ['MoreData', ['a', 'b', 'c', 'd' ], ['a', 'b', 'c', 'd']]
  ]
  </code></pre>
  
  <p>To print this, I wrote:</p>
  
  <pre><code>for item in matrix:
      writer.writerow(item)
  </code></pre>
  
  <p>I wrote the results to a CSV and got this:</p>
  
  <pre><code>FileName    FileA   FileB
  FeatureType Polygon Polygon
  FeatureCount    1643    1646
  SomeNumbers ['-15,51,-58,17'], ['-15,51,-58,17']
  MoreData    ['a', 'b', 'c', 'd'] ['a', 'b', 'c', 'd']
  </code></pre>
  
  <p>What I would like to do is to write code such that I get output like this instead:</p>
  
  <pre><code>FileName    FileA   FileB
  FeatureType Polygon Polygon
  FeatureCount    1643    1646
  SomeNumbers     -15     -15
                   51      51
                  -58    -58
                   17     17
  MoreData    a       a
              b       b
              c       c
              d       d
  </code></pre>
  
  <p>Thanks for your help.</p>