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, table in enumerate(doc.tables): print(f"\n--- TABLE {idx} ---") # print headers and first row rows_to_print = min(3, len(table.rows)) for r_idx in range(rows_to_print): row = table.rows[r_idx] cells = [cell.text.strip().replace('\n', ' ') for cell in row.cells] # remove adjacent duplicates due to merged cells cleaned = [] for c in cells: if not cleaned or cleaned[-1] != c: cleaned.append(c) print(f"Row {r_idx}: {' | '.join(cleaned[:10])}")