import csv def txt2csv(inf, outf): with open(inf,'r') as fin, open(outf,'w',newline='') as fout: wrt = csv.writer(fout) lines = fin.readlines() for line in lines: txt = line.strip().split() wrt.writerow(txt) inf = 'train.txt' outf = 'train.csv' txt2c…