Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/287.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中的doc/docx文件中查找彩色表_Python_Docx - Fatal编程技术网

在python中的doc/docx文件中查找彩色表

在python中的doc/docx文件中查找彩色表,python,docx,Python,Docx,我有一个很长的文档(doc或docx文件),其中包含一些表格。我想在里面找到彩色的桌子 现在我正在加载完整文件: from docx import Document path = "test.docx" doc = Document(path) type(doc.tables) print("Number of tables in document: %s" % len(doc.tables)) Number of tables in document:

我有一个很长的文档(doc或docx文件),其中包含一些表格。我想在里面找到彩色的桌子

现在我正在加载完整文件:

from docx import Document
path = "test.docx"
doc = Document(path)
type(doc.tables)
print("Number of tables in document: %s" % len(doc.tables))
Number of tables in document: 4
我怎样才能找到在背景中着色的人并将其保存在另一个文档中?我的原始文档中有文本和表格

当我跑步时:

for table in doc.tables:
    for row in table.rows:
        for cell in row.cells:            
            print(cell._tc.tcPr.xml)
我可以看到特征细胞有这样一条线:

<w:shd w:val="clear" w:color="auto" w:fill="CCFFCC"/>

但是我如何才能只得到满足这个条件的表呢