My script for counting tables and rows in the word docx working well. My question is why my printing statement printing till the condition gets fail. I attached the image for your reference
Here is my code:
from docx import Document
doc = Document("sample2.docx")
i = 0
for t in doc.tables:
for ro in t.rows:
if ro.cells[0].text=="Test Type" and (ro.cells[2].text=="Black Box" or ro.cells[2].text=="Black-Box"):
i=i+1
print("Total Black Box Tests are: ", i)
j=0
for table in doc.tables:
for row in table.rows:
if row.cells[0].text=="ID":
j=j+1
print("Total no of Tables:", j)
Help me. Thanks!