import csv a = [] f = open('follow_name_1.txt','r',encoding='utf-8') line = f.readline() while line: a.append(line.split())#保存文件是以空格分离的 line = f.readline() f.close() fp = open('follow_name_1.csv','w',encoding='utf_8_sig',newline="") csvwriter=csv.writer(fp) csvwriter.writerows(a) print("finish")