当前位置: 首页 > 工具软件 > :path > 使用案例 >

TypeError: _isdir: path should be string, bytes or os.PathLike, not bool

柯立果
2023-12-01

目录

 复制有风险,粘贴需谨慎

 复制有风险,粘贴需谨慎

 复制有风险,粘贴需谨慎


 

 复制有风险,粘贴需谨慎

 复制有风险,粘贴需谨慎

 复制有风险,粘贴需谨慎

 

import os


def search_by_date(path):
    if os.path.isdir(path):
        dirs = os.listdir(path)
        for i in dirs:
            print(os.path.join(path, i))
            if os.path.isdir(os.path.join(path, i)):
                return search_by_date(os.path.isdir(os.path.join(path, i)))
    else:
        print(path)


path = 'c:/'
search_by_date(path)

 

 

import os


def search_by_date(path):
    if os.path.isdir(path):
        dirs = os.listdir(path)
        for i in dirs:
            print(os.path.join(path, i))
            if os.path.isdir(os.path.join(path, i)):
                return search_by_date(os.path.join(path, i))
    else:
        print(path)


path = 'c:/'
search_by_date(path)

 

 类似资料: