利用python把txt文件里数据的分号;改成空格
import os source_path = './txt' target_path = './result' if not os.path.exists(target_path): os.mkdir(target_path) file_list = os.listdir(source_path) for file in file_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') as f: context = f.readlines() context = list(map(lambda x: x.replace(';',' '),context)) with open(full_tar, 'w') as f: f.writelines(context)