I am new to python I have few doc files in that the paragraph and tables are jumbled in some random order and I want to read those in the exact order and print those
For example: Input file containing data in the below order
- Paragraph
- Table
- Paragraph
- Paragraph
- Table
- Paragraph
- Table
I used he below code for this:-
for para in document.paragraphs:
print(para.text)
for table in document.tables:
for row in table.rows:
for cell in row.cells:
print(cell.text)
The output I got is it printed all text paragraphs together and then it printed all text in tables together. But I want the output as if in the given order in the document.