"""
读取文件中的文件名列表,一行一行的写到txt中
"""
import glob
from write_excel import *
i=1
f=open("1.txt","a")#利用追加模式,参数从w替换为a即可
vol = glob.glob('D:/code/voxelmorph1/data/data/test/image/*')
for i in range(len(vol)):
a = vol[i]
f.write(vol[i]+'\n')
i=i+1
f.close()
05-16
8725
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)