【Python】【递归遍历】os.walk( ) 背景python 代码实现递归遍历Codeimportos image_path_folderr/root_folder_pathimage_exts{.jpg,.jpeg,.png}total_count0forroot,dirs,filesinos.walk(image_path_folder):forfileinfiles:extos.path.splitext(file)[1].lower()ifextnotinimage_exts:continuetotal_count1image_pathos.path.join(root,file)### 合成图片的绝对路径print(f{total_count},\t已生成:{image_path})iffiles![]and1:breakEND