Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f8b455b

Browse files
committed
PERF: allocate fewer strings
1 parent d735219 commit f8b455b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tabulate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def _textile_row_with_attrs(cell_values, colwidths, colaligns):
179179

180180
def _html_begin_table_without_header(colwidths_ignore, colaligns_ignore):
181181
# this table header will be suppressed if there is a header row
182-
return "\n".join(["<table>", "<tbody>"])
182+
return "<table>\n<tbody>"
183183

184184

185185
def _html_row_with_attrs(celltag, cell_values, colwidths, colaligns):
@@ -194,9 +194,9 @@ def _html_row_with_attrs(celltag, cell_values, colwidths, colaligns):
194194
htmlescape(c))
195195
for c, a in zip(cell_values, colaligns)
196196
]
197-
rowhtml = "<tr>" + "".join(values_with_attrs).rstrip() + "</tr>"
197+
rowhtml = "<tr>{}</tr>".format("".join(values_with_attrs).rstrip())
198198
if celltag == "th": # it's a header row, create a new table header
199-
rowhtml = "\n".join(["<table>", "<thead>", rowhtml, "</thead>", "<tbody>"])
199+
rowhtml = "<table>\n<thead>\n{}\n</thead>\n<tbody>".format(rowhtml)
200200
return rowhtml
201201

202202

0 commit comments

Comments
 (0)