Python-100-Days/Day01-15/code/Day15/word2.py

20 lines
358 B
Python
Raw Normal View History

2018-09-25 22:49:21 +08:00
"""
读取Word文件
Version: 0.1
Author: 骆昊
Date: 2018-03-26
"""
from docx import Document
doc = Document('./res/用函数还是用复杂的表达式.docx')
print(len(doc.paragraphs))
print(doc.paragraphs[0].text)
# print(doc.paragraphs[1].runs[0].text)
content = []
for para in doc.paragraphs:
2019-05-03 21:17:36 +08:00
content.append(para.text)
2018-09-25 22:49:21 +08:00
print(''.join(content))