fixed bug where empty tables printed out two footer hrules

This commit is contained in:
Niru Maheswaranathan
2015-02-24 19:37:02 -08:00
parent a69c8becf5
commit c6f5dbe4f3

View File

@@ -53,7 +53,11 @@ def table(data, headers, options=None):
# parse each row
tablestr = headerstr + [row(d, column_width=opts['column_width'], precision=opts['precision'],
outer_char=opts['outer_char']) for d in data] + [hrule]
outer_char=opts['outer_char']) for d in data]\
# only add the final border if there was data in the table
if len(data) > 0:
tablestr += [hrule]
# print the table
print('\n'.join(tablestr))