python读取word中的文本内容
2021-03-26 18:28
阅读:561
标签:code 面向 str cmd命令 安装完成 des int 输出 imp
Python可以利用python-docx模块处理word文档,处理方式是面向对象的。
安装 :在cmd命令行中输入 pip install python-docx
最后提示Successfully installed,表示成功地安装完成
代码:
# encoding=utf-8 import docx #获取文档对象 file=docx.Document("D:Users/FengZH2/Desktop/新能源车技术报告.docx") print("段落数:"+str(len(file.paragraphs)))#段落数 #输出每一段的内容 for para in file.paragraphs: print(para.text)
python读取word中的文本内容
标签:code 面向 str cmd命令 安装完成 des int 输出 imp
原文地址:https://www.cnblogs.com/yukit/p/13683780.html
上一篇:碎片化学习Java
下一篇:C语言 - static 解读
文章来自:搜素材网的编程语言模块,转载请注明文章出处。
文章标题:python读取word中的文本内容
文章链接:http://soscw.com/index.php/essay/68237.html
文章标题:python读取word中的文本内容
文章链接:http://soscw.com/index.php/essay/68237.html
评论
亲,登录后才可以留言!