Python 判断文件夹下 是否存在某种类型的文件

fileRootPath = r'a/b/c/d/'
if any(name.endswith(('.mp4')) for name in os.listdir(fileRootPath):
    print(fileName + ' DLC results file exists')
    log(logpath, fileName + ' DLC results file exists')
    return
posted @ 2021-05-12 10:35  bH1pJ  阅读(274)  评论(0编辑  收藏  举报