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) for idx in range(580, 620): math_para = doc.paragraphs[idx]._p.find('.//{http://schemas.openxmlformats.org/officeDocument/2006/math}oMath') if math_para is not None: math_texts = [t.text for t in doc.paragraphs[idx]._p.iter() if t.tag.endswith('}t')] print(f"Paragraph {idx} (text: '{doc.paragraphs[idx].text}'): {math_texts}")