当前位置:主页 > 软件编程 > Python代码 >

python实现写数字文件名的递增保存文件方法

时间:2021-05-24 08:52:25 | 栏目:Python代码 | 点击:

如下所示:

 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')

您可能感兴趣的文章:

相关文章