pranit_churn_application / tmp_read_docx.py
rajkhanke's picture
Upload 14 files
292c00b verified
raw
history blame contribute delete
656 Bytes
import os, sys
try:
from docx import Document
except ImportError:
import subprocess
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'python-docx'])
from docx import Document
path = r'e:\VsCode\New folder (4)\Final_Paper_Music_AVI_For_Relaxation[1].docx'
print('exists', os.path.exists(path))
if os.path.exists(path):
d = Document(path)
count = 0
for para in d.paragraphs:
t = para.text.strip()
if t:
print(t)
count += 1
if count >= 120:
print('...truncated...')
break
print('para', len(d.paragraphs), 'non_empty', count)