16 lines
534 B
Python
16 lines
534 B
Python
import docx
|
|
|
|
doc = docx.Document(r'C:\Users\simon\Downloads\IT智能在线咨询交接文档-tm.docx')
|
|
|
|
with open(r'C:\Users\simon\wecom_it_smart_desk\docs\现有系统交接文档内容.txt', 'w', encoding='utf-8') as f:
|
|
for para in doc.paragraphs:
|
|
if para.text.strip():
|
|
f.write(para.text + '\n')
|
|
for table in doc.tables:
|
|
f.write('\n=== TABLE ===\n')
|
|
for row in table.rows:
|
|
cells = [cell.text for cell in row.cells]
|
|
f.write(' | '.join(cells) + '\n')
|
|
|
|
print("Done")
|