我正在使用 python docx 库,需要从文档中的表中读取数据。
虽然我可以使用以下代码读取数据,
document = Document(path_to_your_docx)
tables = document.tables
for table in tables:
for row in table.rows:
for cell in row.cells:
for paragraph in cell.paragraphs:
print(paragraph.text)
Run Code Online (Sandbox Code Playgroud)
我得到多个重复值,其中单元格中的内容跨越其合并的单元格,对于合并到其中的每个单元格一次。我不能简单地删除重复值,因为可能有多个未合并的单元格具有相同的值。我应该如何解决这个问题?
作为参考,我被指示从这个 github issue在这里提出问题。
谢谢你。