title: Python Docx : Extract tables between two given strings
body: <p>I am trying to extract a specific list of tables that is found between two pieces of text in a word document. I am using python docx for this and the thing I am facing is that text can be parsed through using</p>
  
  <pre><code>document.paragraphs[index].text
  </code></pre>
  
  <p>while tables are parsed through using</p>
  
  <pre><code>document.tables[index].cell[row,col]
  </code></pre>
  
  <p>This separates the text and the tables making it harder to just have the list of tables contained between two pieces of text. The approach I am trying is to use the element of each list in the form below to obtain the address of the paragraph/table.</p>
  
  <pre><code>&lt;docx.text.paragraph.Paragraph object at 0x04299FD0&gt;
  </code></pre>
  
  <p>I would then extract each table's address and check whether it is between the starting and ending texts' addresses. BUT, the issue is that all the table addresses were larger than the start and ending addresses of the text and I could not find any documentation on how python docx finds those address because I assumed the address was sequential progressively through the document. Can this method work ? What other approach can I try to just look at those tables between two pieces of text in a word document ?</p>