printtools/table.py
def __table_standard(t, padding=' ', indent='', hline=True, heading=False):
    """Print table with vertical dividers."""
    t = [[padding + cell + padding for cell in row] for row in t]

    widths = __get_widths(t)

    # Make horizontal divider
    hdiv = "{indent}+{content}+\n".format(
        indent=indent,
        content='+'.join(['-' * width for width in widths]))

    tout = ''
    if hline:
        tout += hdiv

    for i, row in enumerate(t):
        row_contents = [
            cell + ' ' * (width - len(clear_fmt(cell)))
            for width, cell in zip(widths, row)]
        tout += indent + "|" + "|".join(row_contents) + "|\n"
        if hline or (heading and i == 1):
            tout += hdiv

    return tout
Print table with vertical dividers.
Print table with vertical dividers.
Print table with vertical dividers .
def __table_standard(t, padding=' ', indent='', hline=True, heading=False):
    t = [[padding + cell + padding for cell in row] for row in t]
    widths = __get_widths(t)
    hdiv = "{indent}+{content}+\n".format(
        indent=indent,
        content='+'.join(['-' * width for width in widths]))
    tout = ''
    if hline:
        tout += hdiv
    for i, row in enumerate(t):
        row_contents = [
            cell + ' ' * (width - len(clear_fmt(cell)))
            for width, cell in zip(widths, row)]
        tout += indent + "|" + "|".join(row_contents) + "|\n"
        if hline or (heading and i == 1):
            tout += hdiv
    return tout
def __table_standard ( t , padding = ' ' , indent = '' , hline = True , heading = False ) : t = [ [ padding + cell + padding for cell in row ] for row in t ] widths = __get_widths ( t ) hdiv = "{indent}+{content}+\n" . format ( indent = indent , content = '+' . join ( [ '-' * width for width in widths ] ) ) tout = '' if hline : tout += hdiv for i , row in enumerate ( t ) : row_contents = [ cell + ' ' * ( width - len ( clear_fmt ( cell ) ) ) for width , cell in zip ( widths , row ) ] tout += indent + "|" + "|" . join ( row_contents ) + "|\n" if hline or ( heading and i == 1 ) : tout += hdiv return tout
Print table with vertical dividers.
Print table with vertical dividers .
"""Print table with vertical dividers.""" # Make horizontal divider
t
padding
indent
hline
heading