生活中只有两种选择:重新开始,成为自己生活的主角;或留在原处并成为他人的支持角色。生活中,很多时候都需要我们要耐心,耐心做人,耐心做事,更要耐心生活。
如下所示:
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实现写数字文件名的递增保存文件方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。