python txt转换csv 快速

import csv
csvFile = open("/Users/wyc/work/geneSearch/server/search/datas_train.csv",'w',newline='',encoding='utf-8')
writer = csv.writer(csvFile)
csvRow = []

f = open("/Users/wyc/work/geneSearch/server/search/test-20220607.txt",'r')
for line in f:
    csvRow = line.split()
    writer.writerow(csvRow)

f.close()
csvFile.close()

 

posted @ 2022-06-08 15:32  WrYcF  阅读(280)  评论(0编辑  收藏  举报
Live2D