-1
docxという単語のテーブルと行を数えるためのスクリプトです。私の質問は、条件が失敗に終わるまでの私の印刷ステートメントの印刷はなぜですか。pythonで複数回印刷する関数を印刷
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)
が私を助けて:私は
はここに私のコードは、あなたの参考のために画像を添付しました。ありがとう!最後のprint文のインデントと
をお試しください! 0インクリメントのレベルでプリントを移動してください。 –