text_20241014
text_20241014
text_20241014
/usr/bin/env python
# -*- coding: utf-8 -*-
# haowen.zheng
import linecache
def has_ten_spaces(s):
return ' ' * 10 in s
path_temp_file = r"C:\Users\www74\Desktop\每日问题"
# 原始文件,移动办公复制出的聊天记录
file_path = path_temp_file + r'\11.txt'
# 中间文件,不关注
file_path_temp = path_temp_file + r'\temp.txt'
# 中间文件,不关注
new_file_path = path_temp_file + r'\modified_example.txt'
t = []
t1 = []
list_pd_temp = {}
for key, value in list_text.items():
for t1 in lists_text:
if key in t1[1]:
try:
list_pd_temp[key] = list_pd_temp[key] + "\答:" + t1[0] + t1[1]
except:
list_pd_temp[key] = t1[0] + t1[1]
list_pd_a = []
import pandas as pd
# 创建 DataFrame
df = pd.DataFrame(list_pd_a)
# 将 DataFrame 写入 Excel 文件
excel_file_path = path_temp_file + r'\output.xlsx'
df.to_excel(excel_file_path, index=False) # index=False 表示不写入行索引