from docx import Document doc = Document(r"g:\Sync_File\Семестр 3\АИИР\КР\КР_out.docx") print("=== biblio-ish ===") for i, p in enumerate(doc.paragraphs): t = p.text.strip() style = p.style.name if p.style else None if "ИСПОЛЬЗОВАНН" in t.upper(): print(i, style, t[:80]) if style == "Bibliography" or (t[:2] in {f"{n}." for n in range(1, 10)} and len(t) > 50): print(i, style, t[:100]) print("=== double spaces in captions ===") for p in doc.paragraphs: if p.style and "Caption" in (p.style.name or "") and " " in p.text: print(repr(p.text[:90])) print("=== sections ===") for i, s in enumerate(doc.sections): has_page = "PAGE" in s.footer._element.xml print(i, "PAGE field", has_page) print("=== Heading 1 ===") for p in doc.paragraphs: if p.style and p.style.name == "Heading 1": print(repr(p.text[:100]))