Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x odfpy:需要复制现有表_Python 3.x_Odfpy - Fatal编程技术网

Python 3.x odfpy:需要复制现有表

Python 3.x odfpy:需要复制现有表,python-3.x,odfpy,Python 3.x,Odfpy,我对odfpy和Python 3有一个问题。我尝试复制Opendocument文本文件中的现有表。我无法从原始表中获取样式信息。这是我的密码: # templateTable is a table.Table that has to be copied for childNode in templateTable.childNodes: if 'style-name' in str(childNode.attributes): # the next command fai

我对odfpy和Python 3有一个问题。我尝试复制Opendocument文本文件中的现有表。我无法从原始表中获取样式信息。这是我的密码:

# templateTable is a table.Table that has to be copied
for childNode in templateTable.childNodes:
    if 'style-name' in str(childNode.attributes):
        # the next command fails and the python interpreter tells me
        # 'style-name' is not in list
        style = childNode.getAttribute('style-name')

欢迎帮助

我终于自己找到了解决办法。我想与你分享它,以防其他人不得不处理与我相同的问题。你可以找到代码