我的目标是用PyLatex创建一个浮动表,为此我想使用类Table。但是当我初始化一个Table时,我得到了以下错误:
Traceback (most recent call last):
File "table.py", line 18, in <module>
table = Table('rc|cl')
TypeError: __init__() takes exactly 1 argument (2 given)这真的很令人困惑,因为我认为'rc|cl'是1个参数。为了确保我没有出错,我从Nullege执行了一个脚本,这导致了上面的错误。
发布于 2017-07-28 16:07:46
正如Feodoran在他的评论中提到的那样,表格必须包装在表格中才能使其浮动。
doc = Document()
with doc.create(Table()):
with doc.create(Tabular("llr")) as tabular:
tabular.add_row(("Foo", "Bar", "Foobar"))
tabular.add_hline()
# etchttps://stackoverflow.com/questions/45366740
复制相似问题