19 lines
456 B
Python
19 lines
456 B
Python
from docx import Document
|
|
|
|
def read_docx(file_path):
|
|
# 尝试打开文档
|
|
try:
|
|
doc = Document(file_path)
|
|
except Exception as e:
|
|
print(f"Error opening file: {e}")
|
|
return
|
|
|
|
# 读取文档中的所有段落并打印它们
|
|
for para in doc.paragraphs:
|
|
print(para.text)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
file_path="C:\\Users\\Administrator\\Desktop\\招标文件\\招标02_invalid.docx"
|
|
read_docx(file_path)
|