There was a mistake when traversing the picture file with os's join

an error occurred while traversing the picture file with os"s join

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"

ask God for help!

Jan.18,2022

Isn't the error

TypeError: join () argument must be str or bytes, not 'list', prompted, os.walk (' data/train/'). The file you output is of type list, and the os.path.join parameter cannot be of type list

.

Rookie tutorial os.walk usage: python/os-walk.html" rel=" nofollow noreferrer "> python/os-walk.html" rel= "nofollow noreferrer" > http://www.runoob.com/python/.


for dirpath,subdirs,filenames in os.walk(path):
    for filename in filenames:
        fullname = os.path.join(dirpath, filename)
        ......
Menu