Skip to content

Commit 0c88f25

Browse files
osolevemahmoud
authored andcommitted
Fix Table.to_text() sizing
Table.to_text now measures column contents instead of row length when sizing the individual columns.
1 parent d70669a commit 0c88f25

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

boltons/tableutils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def to_text(self, with_headers=True, maxlen=None):
569569
text_data = [[to_text(cell, maxlen=maxlen) for cell in row]
570570
for row in self._data]
571571
for idx in range(self._width):
572-
cur_widths = [len(cur) for cur in text_data]
572+
cur_widths = [len(row[idx]) for row in text_data]
573573
if with_headers:
574574
cur_widths.append(len(to_text(headers[idx], maxlen=maxlen)))
575575
widths.append(max(cur_widths))

0 commit comments

Comments
 (0)