本文整理汇总了Python中tabulate.DataRow方法的典型用法代码示例。如果您正苦于以下问题:Python tabulate.DataRow方法的具体用法?Python tabulate.DataRow怎么用?Python tabulate.DataRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tabulate
的用法示例。
在下文中一共展示了tabulate.DataRow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_custom_tablefmt
# 需要导入模块: import tabulate [as 别名]
# 或者: from tabulate import DataRow [as 别名]
def test_custom_tablefmt():
"Regression: allow custom TableFormat that specifies with_header_hide (github issue #20)"
tablefmt = TableFormat(
lineabove=Line("", "-", " ", ""),
linebelowheader=Line("", "-", " ", ""),
linebetweenrows=None,
linebelow=Line("", "-", " ", ""),
headerrow=DataRow("", " ", ""),
datarow=DataRow("", " ", ""),
padding=0,
with_header_hide=["lineabove", "linebelow"],
)
rows = [["foo", "bar"], ["baz", "qux"]]
expected = "\n".join(["A B", "--- ---", "foo bar", "baz qux"])
result = tabulate(rows, headers=["A", "B"], tablefmt=tablefmt)
assert_equal(result, expected)
示例2: _addCustomTabulateTables
# 需要导入模块: import tabulate [as 别名]
# 或者: from tabulate import DataRow [as 别名]
def _addCustomTabulateTables():
"""Create a custom ARMI tables within tabulate."""
tabulate._table_formats["armi"] = tabulate.TableFormat(
lineabove=tabulate.Line("", "-", " ", ""),
linebelowheader=tabulate.Line("", "-", " ", ""),
linebetweenrows=None,
linebelow=tabulate.Line("", "-", " ", ""),
headerrow=tabulate.DataRow("", " ", ""),
datarow=tabulate.DataRow("", " ", ""),
padding=0,
with_header_hide=None,
)
tabulate.tabulate_formats = list(sorted(tabulate._table_formats.keys()))
tabulate.multiline_formats["armi"] = "armi"
# runLog makes tables, so make sure this is setup before we initialize the runLog