From 5a513f375f9b19f00bc75abcfd40f85cde4e4a75 Mon Sep 17 00:00:00 2001 From: Niru Maheswaranathan Date: Tue, 3 May 2016 23:17:49 -0700 Subject: [PATCH] Makes the message length the minimum width in banner() --- tableprint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tableprint.py b/tableprint.py index 9423603..c49abbd 100644 --- a/tableprint.py +++ b/tableprint.py @@ -18,7 +18,7 @@ import sys import numpy as np __all__ = ['table', 'header', 'row', 'hr', 'top', 'bottom', 'banner', 'dataframe', 'humantime'] -__version__ = '0.4.0' +__version__ = '0.4.1' # set up table styles LineStyle = namedtuple('LineStyle', ('begin', 'hline', 'sep', 'end')) @@ -246,7 +246,7 @@ def banner(message, width=30, style='banner', out=sys.stdout): out : writer An object that has write() and flush() methods (Default: sys.stdout) """ - out.write(header([message], width, style) + '\n') + out.write(header([message], max(width, len(message)), style) + '\n') out.flush()