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")
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/python/279341.html