qq_38436848
qq_38436848
采纳率0%
2018-12-06 11:24 阅读 745

python 用os的join遍历图片文件时出错了

python 用os的join遍历图片文件时出错了

import os

    #遍历目录
for root,dirs,file in os.walk('C:/Users/10748/Desktop/flow/data/train/'):
            #打印图片路径及名称
    image_path = os.path.join(root,file)
    print(image_path)

```  File "D:\Anaconda3\envs\tensorflow-gpu\lib\genericpath.py", line 149, in _check_arg_types
    (funcname, s.__class__.__name__)) from None

TypeError: join() argument must be str or bytes, not 'list'

```求大神帮帮忙吧 !

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • crf_moonlight crf_moonlight 2018-12-06 16:44
    for root,dirs,files in os.walk('C:/Users/10748/Desktop/flow/data/train/'):
         #打印图片路径及名称
            for file in files:
                image_path = os.path.join(root,file)
                print(image_path)
    

    这特么网站对齐有问题啊...博客好好的问答怎么这么烂

    点赞 评论 复制链接分享

相关推荐