def render_table(header_row, data):
 table = ([header_row] + data)
 max_lens = [max((len(compat_str(v)) for v in col)) for col in zip(*table)]
 format_str = (u' '.join((((u'%-' + compat_str((ml + 1))) + u's') for ml in max_lens[:(-1)])) + u'%s')
 return u'\n'.join(((format_str % tuple(row)) for row in table))

def render_table ( header_row , data ) : table = ( [ header_row ] + data ) max_lens = [ max ( ( len ( compat_str ( v ) ) for v in col ) ) for col in zip ( * table ) ] format_str = ( u' ' . join ( ( ( ( u'%-' + compat_str ( ( ml + 1 ) ) ) + u's' ) for ml in max_lens [ : ( - 1 ) ] ) ) + u'%s' ) return u'\n' . join ( ( ( format_str % tuple ( row ) ) for row in table ) )
render a list of rows .