title: how to normalize list of lists of strings in python?
body: <p>I have a list of lists that represent a grid of data (think rows in a spreadsheet). Each row can have an arbitrary number of columns, and the data in each cell is a string of arbitrary length.</p>
  
  <p>I want to normalize this to, in effect, make each row have the same number of columns and each column in the data have the same width, padding with spaces as necessary. For example, given the following input:</p>
  
  <pre><code>(
   ("row a", "a1","a2","a3"),
   ("another row", "b1"),
   ("c", "x", "y", "a long string")
  )
  </code></pre>
  
  <p>I want the data to look like this:</p>
  
  <pre><code>(
   ("row a      ", "a1", "a2", "a3           "),
   ("another row", "b1", "  ", "             "),
   ("c          ", "x ", "y ", "a long string")
  )
  </code></pre>
  
  <p>What's the pythonic solution for python 2.6 or greater? Just to be clear: I'm not looking to pretty-print the list <em>per se</em>, I'm looking for a solution that returns a new list of lists (or tuple of tuples) with the values padded out. </p>