9 lines
315 B
Python
9 lines
315 B
Python
from docx import Document
|
|
doc = Document('mianyang/mianyang.docx')
|
|
for i, para in enumerate(doc.paragraphs):
|
|
style_name = getattr(para.style, 'name', '') or ''
|
|
if style_name.startswith('Heading'):
|
|
text = para.text.strip()
|
|
if text:
|
|
print(f'[{i}] {style_name}: {repr(text[:80])}')
|