fp_out = open(out_path, 'w', encoding='utf-8')
with open(in_path, 'r', encoding='utf-8') as fp:
for i, txt in enumerate(fp.readlines()):
if i > 10:
break
txt_list = txt.split('。')
txt_list_new = list(filter(lambda x: re.sub(r'[()\[\]()【】{},,.。!!??]', '', x.strip()) != '', txt_list))
for txt_new in txt_list_new:
if txt_new.strip():
fp_out.write(txt_new.strip() + '。' + '\n')
fp_out.write('\n')
fp_out.close()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)