create_dataset.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:Chinese-QA 作者: distantJing 项目源码 文件源码
def exact_content():
    contend = ''
    f_in = open(dat_dir, 'r', encoding='utf-8')
    total = len(f_in.readlines())
    f_in.close()
    if  os.path.exists(out):
        os.remove(out)
    f_out = open(out, 'w', encoding='utf-8')
    with open(dat_dir, 'r', encoding='utf-8') as f_in:
        for line in tqdm(f_in, total=total) :
#           time.sleep(1)
            x = '<content>'
            y = line[0:min(len(x),len(line))]
            if operator.eq(x, y) == True:
                contend = line[len(x):len(line)-len(x)] + '\n'
                f_out.write(contend)
#   print(contends)
    f_out.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号