python 图像存储路径批量读取

  • Post author:
  • Post category:python


读取文件夹中图像路径并写入列表中

import os
path = 'H:\\BaiduNetdiskDownload\\train_dog_cat'
for dirpath,dirnames,filenames in os.walk(path):
    image=[]
    for filename in filenames:
        img=os.path.join(dirpath,filename)
        image.append(img)
    print(image)



版权声明:本文为deweicengyou原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。