惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
F
Full Disclosure
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Engineering at Meta
Engineering at Meta
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Threatpost
I
Intezer
V2EX - 技术
V2EX - 技术
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
小众软件
小众软件
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
N
News | PayPal Newsroom
MyScale Blog
MyScale Blog
AI
AI
Vercel News
Vercel News
Spread Privacy
Spread Privacy
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
Help Net Security
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
L
LINUX DO - 热门话题
U
Unit 42
L
LangChain Blog
Recent Announcements
Recent Announcements

博客园 - SimpleSmile

Axure10 在线编辑echart mysql获取库内所有表ddl结构说明 windows环境下安装kafka pip升级 关于SpringBoot的valid校验运行原理-自学 centos下python3.6.8 安装ssl模块 windows根据文件名找到进程,并杀死进程。 Oracle关联表进行修改操作(查询某个表,以某个表作为基础,修改其它表) 解决CentOS 7.x虚拟机无法上网的问题 ORA-00972: identifier is too long异常处理 resttemplate 由于框架原因自带了转xml方式,不改变框架底层情况下,修复为返回json格式 java 操作excel 当jar包执行时,内嵌的文件找不到时,可以这样解决! Email Windows发送成功,Linux却发送失败的可能原因 解决linux时间转换为yyyy-MM-dd md5加密中文windows和linux不一致 【WebDriver实战问题】selenium调用IE11浏览器,报错“找不到元素” mysql sql查询中文正常,而jdbc查询出来是byte[]类型处理 单表递归,查询组织及其自组织的内容信息 vi 关闭自动缩进
python 读写word
SimpleSmile · 2021-07-07 · via 博客园 - SimpleSmile
'''
    #利用python读取word文档,先读取段落
    # pip install docx
    # pip3 install python-docx
'''
#导入所需库
from docx import Document
class docxOpraCls:
 myDoc = ''
 def openDoc(_self,path):
  #打开word文档
  document = Document(path)
  _self.myDoc = document
  #获取所有段落
  all_paragraphs = document.paragraphs
  #获取表格内容
  tables = document.tables
  #打印看看all_paragraphs是什么东西
  print(type(all_paragraphs)) #<class 'list'>,打印后发现是列表
  #是列表就开始循环读取
  #for paragraph in tables:
   #打印每一个段落的文字
   #print(paragraph.text)
  for table in tables[:]:
   for i, row in enumerate(table.rows[:]):  # 读每行
    row_content = []
    for cell in row.cells[:]:  # 读一行中的所有单元格
     c = cell.text
     row_content.append(c)
    print(row_content)  # 以列表形式导出每一行数据
 def writeContent(_self,systemName,ipAddress,level,note,changeNote,changeAuthor):
  tables = _self.myDoc.tables
  firstTab = tables[1]
  newRowsCells = firstTab.add_row().cells
  newRowsCells[0].text = systemName
  newRowsCells[1].text = ipAddress
  newRowsCells[2].text = level
  newRowsCells[3].text = note
  newRowsCells[4].text = changeNote
  newRowsCells[5].text = changeAuthor
  return
 def saveDoc(_self,path):
  _self.myDoc.save(path)
  return