本文整理汇总了Python中texttable.Texttable.reset方法的典型用法代码示例。如果您正苦于以下问题:Python Texttable.reset方法的具体用法?Python Texttable.reset怎么用?Python Texttable.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类texttable.Texttable
的用法示例。
在下文中一共展示了Texttable.reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dump
# 需要导入模块: from texttable import Texttable [as 别名]
# 或者: from texttable.Texttable import reset [as 别名]
def dump(relation):
width,height = term_size()
table = Texttable(width)
sample, iterator = tee(relation)
table.add_rows(take(1000,sample))
table._compute_cols_width()
del sample
table.reset()
table.set_deco(Texttable.HEADER)
table.header([f.name for f in relation.schema.fields])
rows = take(height-3, iterator)
try:
while rows:
table.add_rows(rows, header=False)
print table.draw()
rows = take(height-3, iterator)
if rows:
raw_input("-- enter for more ^c to quit --")
except KeyboardInterrupt:
print
示例2: print_class
# 需要导入模块: from texttable import Texttable [as 别名]
# 或者: from texttable.Texttable import reset [as 别名]
def print_class(c):
blank = []
for i in range(10):
blank.append(' ')
table = Texttable()
table.set_deco(Texttable.HEADER)
for cs,item in c.items():
table.header(blank)
print "Class identifier: %g"%(cs)
row = []
for i in item:
row.append(i)
if len(row) == 10:
table.add_row(row)
row = []
if len(row) != 0 and len(row) < 10:
row += blank[(len(row)):]
table.add_row(row)
print table.draw()
table.reset()