##写入csv
dic=[1,2,3,4,5]
# # file = open(’21.txt’, mode=’w’,encoding=’UTF-8′)
# # file.write(dic)
# # # 关闭文件,不关闭文件可能会出问题
# # file.close()
#########################################################
##写入csv
import csv
f=open(‘data.csv’,’w’)
csvwriter=csv.writer(f)
dic=[1,2,3,4,5]
csvwriter.writerow(dic)
f.close()
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/280854.html