def _get_table_str(table):
 table_str = ''
 col_size = [max((len(str(val)) for val in column)) for column in zip(*table)]
 for line in table:
  table_str += '\n'
  table_str += '    '.join(('{0:<{1}}'.format(val, col_size[i]) for (i, val) in enumerate(line)))
 return table_str

def _get_table_str ( table ) : table_str = '' col_size = [ max ( ( len ( str ( val ) ) for val in column ) ) for column in zip ( * table ) ] for line in table : table_str += '\n' table_str += '    ' . join ( ( '{0:<{1}}' . format ( val , col_size [ i ] ) for ( i , val ) in enumerate ( line ) ) ) return table_str
pretty print a table provided as a list of lists .