如下所示:
col = [] img = "test1" img1 = "test2" col.append(img) col.append(img1) data=np.array(col) np.savetxt('/public/home/student6/test/test.csv',data,fmt='%s') col=[] img2 = "test3" img3 = "test4" col.append(img2) col.append(img3) data=np.array(col) i = 1 np.savetxt('/public/home/student6/test/test'+'%d.csv'%i ,data,fmt='%s')
最主要就是如下代碼段的寫法
np.savetxt('/public/home/student6/test/test'+'%d.csv'%i ,data,fmt='%s')
以上這篇python實現寫數字文件名的遞增保存文件方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林站長站。
新聞熱點
疑難解答