把文件夹下的图片都改成路径存到txt文件中
import os
pic_paths= "D:/newfruit/images/val"
f=open('val.txt', 'w')
filenames=os.listdir(pic_paths)
filenames.sort()
for filename in filenames:
out_path="/images/val/" + filename
print(out_path)
f.write(out_path+'\n')
f.close()