From 83b7bdfc05c8da0019382101bec2a6757bfb3c7d Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Thu, 15 Sep 2016 10:01:14 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=20=D1=82?= =?UTF-8?q?=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D1=8B=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=81=D0=BE=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/calculate/lib/utils/text.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pym/calculate/lib/utils/text.py b/pym/calculate/lib/utils/text.py index 8da3751..7baac7b 100644 --- a/pym/calculate/lib/utils/text.py +++ b/pym/calculate/lib/utils/text.py @@ -192,17 +192,17 @@ class tableReport(object): columnsWidth.append(0) # Вычисляем ширину столбцов for e in self.dataList: - i = 0 - for s in e: + for i, s in enumerate(e): lenS = len(_u(s))+1 if columnsWidth[i] < lenS: columnsWidth[i] = lenS - i += 1 return columnsWidth - def createFormatStr(self, listStr): + def createFormatStr(self, listStr, offset=0): """Создает список (текст, ширина ...)""" - return chain(*izip_longest(listStr, self.columnsWidth, fillvalue="")) + return chain(*izip_longest(listStr, + map(lambda x:x-offset, self.columnsWidth), + fillvalue="")) def printFunc(self, s): """ @@ -246,7 +246,7 @@ class tableReport(object): columnMatrix(*self.createFormatStr(listStrSep))]] for s in self.dataList: printData.append([self.vertChar, self.body_printer, - columnMatrix(*self.createFormatStr(s))]) + columnMatrix(*self.createFormatStr(s, 1))]) printData.append([self.crossChar, self.line_printer, columnMatrix(*self.createFormatStr(listStrSep))]) last_col = len(self.headerList) - 1