python读取txt加号分隔符_利用python读取txt文件里数据的分号;改成空格

import os

source_path= './txt'target_path= './result'

ifnot os.path.exists(target_path):

os.mkdir(target_path)

file_list=os.listdir(source_path)for file infile_list:

full_sou=os.path.join(source_path, file)

full_tar=os.path.join(target_path, file)

print("process:", full_sou)

with open(full_sou,'r') asf:

context=f.readlines()

context= list(map(lambda x: x.replace(';',' '),context))

with open(full_tar,'w') asf:

f.writelines(context)