python 将文件夹中的图片路径保存到txt文件中

import os
paths= "/home/li/data/data_无全黑边缘/train/aug_gt/0"
f=open('aug_gt.txt', 'w')
filenames=os.listdir(paths)
filenames.sort()
for filename in filenames:

    out_path="train/aug_gt/0/" + filename
    print(out_path)
    f.write(out_path+'\n')
f.close()

 

上一篇:workaround for COM_ATTRFRG_GEN 066


下一篇:最大流算法小结