19 lines
474 B
Python
19 lines
474 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\\货物标\\zbfilesdocx\\招标文件正文(1)(1).docx"
|
|
read_docx(file_path)
|