word资料处理 -------> 存入excel
精简地从word文档读取资料,分析后传入excel文档。
不是txt!因为我的电脑是mac,针对txt的乱码问题解决不了。
主要操作的思维导图:
源代码:
from docx import Document
import openpyxl
# 创建一个表格存储信息
wb = openpyxl.Workbook()# 不是打开本地的excel,是重新新建打开
sheet1 = wb.active
sheet1.title = 'teaching_example'
# 设置表格大概的样子 表头
sheet1['A1'] = 'id'
sheet1['B1'] = 'word'
sheet1['C1'] = 'counting'
doc = Document('teach_test.docx')
# 打开文档
list_delete = [',', '.','_','-','?','“','"','”','(',')',':',';','\'']
d = {}
def count_words(sen_list):
f