普通版降重
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.5 KiB

# -*- coding: utf-8 -*-
"""
@Time : 2023/2/9 18:53
@Author :
@FileName:
@Software:
@Describe:
"""
def biaot(biao):
biao_len = 8 - len(biao)
return biao + " " * biao_len + ""
biaoti = ["model_1", "model_2", "model_3", "model_4", "model_5"]
import pandas as pd
import os
path = './data/11篇测试excel_汇总_4'
path_list = []
for file_name in os.listdir(path):
path_list.append(file_name)
for file_name in path_list:
data = pd.read_excel(path + "/" + file_name).values.tolist()
# data_new = sorted(data,key=lambda x:len(x[0]))
txt_list = []
file_name_0 = file_name.split(".")[0]
for data_one in data:
biaoti_one = "原文" + " " * 4 + ""
txt = data_one[0]
txt_list.append(biaoti_one + txt)
biaoti_one = biaot(biaoti[0])
txt = data_one[1]
txt_list.append(biaoti_one + txt)
biaoti_one = biaot(biaoti[1])
txt = data_one[2]
txt_list.append(biaoti_one + txt)
biaoti_one = biaot(biaoti[2])
txt = data_one[3]
txt_list.append(biaoti_one + txt)
biaoti_one = biaot(biaoti[3])
txt = data_one[4]
txt_list.append(biaoti_one + txt)
biaoti_one = biaot(biaoti[4])
txt = data_one[5]
txt_list.append(biaoti_one + txt)
txt_list.append("\n")
with open("./data/11篇测试txt_汇总_2/{}.txt".format(file_name_0), "w", encoding='utf-8') as file:
for i in txt_list:
file.write(i + '\n')
file.close()