def _measure_tables(tables, settings):
 simple_tables = _simple_tables(tables, settings)
 tab = [x.as_text() for x in simple_tables]
 length = [len(x.splitlines()[0]) for x in tab]
 len_max = max(length)
 pad_sep = []
 pad_index = []
 for i in range(len(tab)):
  nsep = (tables[i].shape[1] - 1)
  pad = int(((len_max - length[i]) / nsep))
  pad_sep.append(pad)
  len_new = (length[i] + (nsep * pad))
  pad_index.append((len_max - len_new))
 return (pad_sep, pad_index, max(length))

def _measure_tables ( tables , settings ) : simple_tables = _simple_tables ( tables , settings ) tab = [ x . as_text ( ) for x in simple_tables ] length = [ len ( x . splitlines ( ) [ 0 ] ) for x in tab ] len_max = max ( length ) pad_sep = [ ] pad_index = [ ] for i in range ( len ( tab ) ) : nsep = ( tables [ i ] . shape [ 1 ] - 1 ) pad = int ( ( ( len_max - length [ i ] ) / nsep ) ) pad_sep . append ( pad ) len_new = ( length [ i ] + ( nsep * pad ) ) pad_index . append ( ( len_max - len_new ) ) return ( pad_sep , pad_index , max ( length ) )
compare width of ascii tables in a list and calculate padding values .