diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2014-08-13 00:04:36 -0400 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2014-08-13 00:04:36 -0400 |
| commit | e10be35c3b30202630ba486f725da9103dc9d930 (patch) | |
| tree | 8a84381d71b6bae1893f0f0650109b695518c490 | |
| parent | 55bd259ff4c29cb67656261059e8104814f5fc4d (diff) | |
| download | tabletext-e10be35c3b30202630ba486f725da9103dc9d930.tar.gz | |
Fix bug in Python 3, better not rely on the trailing comma to prevent newline printing
| -rw-r--r-- | tabletext.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tabletext.py b/tabletext.py index dc9053a..76558c1 100644 --- a/tabletext.py +++ b/tabletext.py @@ -26,7 +26,7 @@ def top_rule(widths, corners, hor): def inner_rule(widths, corners, hor): return (corners[3] + corners[4].join(hor * width for width in widths) - + corners[5]) + "\n" + + corners[5]) def bottom_rule(widths, corners, hor): @@ -42,7 +42,7 @@ def format_entry(entry, format_string, padding): def format_row(row, formats, padding, ver): return (ver + ver.join(format_entry(entry, format_string, padding) for entry, format_string in zip(row, formats)) - + ver) + "\n" + + ver) def add_width(format_string, width): @@ -68,14 +68,14 @@ def print_table(table, formats=None, padding=(1, 1), corners="┌┬┐├┼┤ formats = add_widths(formats, widths, padding) if header: print top_rule(widths, header_corners, header_hor) - print format_row(table[0], formats, padding, header_ver), - print inner_rule(widths, header_corners, header_hor), + print format_row(table[0], formats, padding, header_ver) + print inner_rule(widths, header_corners, header_hor) table = table[1:] else: print top_rule(widths, corners, hor) - print inner_rule(widths, corners, hor).join(format_row(row, formats, - padding, ver) - for row in table), + print ("\n" + inner_rule(widths, corners, hor) + + "\n").join(format_row(row, formats, padding, ver) + for row in table) print bottom_rule(widths, corners, hor) |
