举个例子: import csv import os path='/tmp/' file='test.csv' def generate_csv(path,file): if not os.path.exists(path): os.mkdir(path) files=os.path.join(path,file) # os.system('touch %s' %files) with open(files,'w') as f: writer=csv.writer(f) writer.write…
import csvdef convert_txt_to_csv(out_file_path, input_file_path, txt_sep): #定义输出路径,输入文件路径,txt的分隔符 with open("./temp.csv", "w", newline = "") as csv_file: writer = csv.writer(csv_file) mark = 0 with open(temp_path) as f: for l…