普通版降重
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.

34 lines
853 B

# -*- coding: utf-8 -*-
"""
@Time : 2023/2/2 11:29
@Author :
@FileName:
@Software:
@Describe:
"""
def read_text(file):
try:
with open(file, 'r', encoding="utf-8") as f:
lines = [x.strip() for x in f if x.strip() != '']
except:
with open(file, 'r', encoding="gbk") as f:
lines = [x.strip() for x in f if x.strip() != '']
return lines
if __name__ == '__main__':
data = []
# path_list = ["train_yy_sim_10.txt", "train_yy_1_sim_10.txt"]
path_list = ["../data/train_new/train_yy.txt", "../data/train_new/train_yy_1.txt"]
for i in path_list:
data += read_text(i)
print(len(data))
fileName = '../data/train_new/train_yy.txt'
with open(fileName, 'w', encoding='utf-8') as file:
for i in data:
file.write(str(i) + '\n')
file.close()