统计指定文件夹内文件的数量
# -*- coding: utf-8 -*-
# @Time : 2022/6/23 9:48
# @Author : lc
# @File : count_file.py
# @Software: PyCharm
# @Function: Count the number of files in the specified folder
import os
if __name__ == '__main__':
path = r'./images'
for (root, dirs, files) in os.walk(path):
print('Current directory:', root)
print('Number of dirs:', len(dirs))
print('Number of files:', len(files))