你好,我是UP:法学院毕业的Python程序员兆锋(点击查看🏆近期的付费答疑记录),
如有学习问题,欢迎加入学习群和我交流❤交流群
主要内容
视频内容
本讲代码
pure
# -*- coding: utf-8 -*-# @Time : 2020/8/20 19:10# @公众号 :Python自动化办公社区# @File : pure.py# @Software: PyCharm# @Description:from docx import Documentdocument = Document('pure.docx')all_paragraphs = document.paragraphsfor p in all_paragraphs:print(p.text)
word_table
# -*- coding: utf-8 -*-# @Time : 2020/8/20 19:10# @公众号 :Python自动化办公社区# @File : word_table.py# @Software: PyCharm# @Description:import zipfileword_book = zipfile.ZipFile('word_table.docx')xml = word_book.read("word/document.xml").decode('utf-8')# print(xml)xml_list = xml.split('<w:t>')print(xml_list)text_list = []for i in xml_list:if i.find('</w:t>') + 1:text_list.append(i[:i.find('</w:t>')])else:passtext = "".join(text_list)print(text)
配套文档
拓展内容
- Pandas官方文档中文版PDF下载
- 详解 | Python&PyCharm的软件下载和安装
- 我在视频中用的代码字体和页面主题
- 🌈彩蛋文件夹,全是自动化办公干货,不点后悔系列
- Python知识星球👉点击直达
提问与答疑
提供以下3种交流方式:
