MIF_E31231430/search_docx.py

23 lines
994 B
Python

import docx
path = "PERANCANGAN SISTEM REKOMENDASI KAMERA PADA PERSEWAAN KAMERA DENGAN BERBASIS WEBSITE MENGUNAKAN ALGORITMA TOPSIS (Revisi 6 fix bismillah).docx"
doc = docx.Document(path)
print(f"Total paragraphs: {len(doc.paragraphs)}")
print(f"Total tables: {len(doc.tables)}")
# Let's search for paragraphs containing "PriceScore" or "ISO Score" or "Canon M10"
for idx, para in enumerate(doc.paragraphs):
text = para.text
if "PriceScore" in text or "ISOScore" in text or "AFScore" in text or "Sensor Score" in text or "Canon M10" in text:
print(f"Paragraph {idx}: {text[:150]}...")
# Let's search for tables containing "Canon M10" or "Skor Kriteria"
for idx, table in enumerate(doc.tables):
for r_idx, row in enumerate(table.rows):
cells = [cell.text for cell in row.cells]
row_text = " | ".join(cells)
if "Canon M10" in row_text or "Sony A5000" in row_text:
print(f"Table {idx}, Row {r_idx}: {row_text[:150]}")
break