网络编程
位置:首页>> 网络编程>> Python编程>> python实现写数字文件名的递增保存文件方法

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

作者:gorgeous___youth  发布时间:2022-10-18 18:50:50 

标签: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')

来源:https://blog.csdn.net/qq_37950540/article/details/82226759

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com