title: python -docx to extract table from word docx
body: <p>I know this is a repeated question but the other answers did not work for me.
  I have a word file that consists of one table. I want that table as an output of my python program. I'm using python 3.6 and I have installed python -docx as well. Here is my code for the data extraction</p>
  <pre><code>from docx.api import Document
  
  document = Document('test_word.docx')
  table = document.tables[0]
  
  data = []
  
  keys = None
  for i, row in enumerate(table.rows):
      text = (cell.text for cell in row.cells)
  
      if i == 0:
          keys = tuple(text)
          continue
      row_data = dict(zip(keys, text))
      data.append(row_data)
      print (data)
  </code></pre>
  <p>I want the result that exactly looks like the word docx file. Thanks in advance</p>