上代码:
import os
# 设置要遍历的文件夹路径
folder_path = 'utils'
# 遍历文件夹
for dirname, subdirs, files in os.walk(folder_path):
print(f'Found directory: {dirname}')
for file in files:
print(f'{os.path.join(dirname, file)} is a file')
# 如果需要遍历子文件夹,上面的代码已经处理了
效果:







![[米联客-XILINX-H3_CZ08_7100] FPGA程序设计基础实验连载-24 TPG图像测试数据发生器设计](https://i-blog.csdnimg.cn/direct/96f5dbecc8654442a4ac28421b147546.png)












