file = ‘./myfile/’
for f in glob.glob(os.path.join(file, “*/*.jpg”)): # 根据文件类型替换jpg,如文件深度更深,通过添加*/解决
print(f)
dir_name = “_”.join(f.split(“/”)[-3:-1])
file = ‘./myfile/’
for f in glob.glob(os.path.join(file, “*/*.jpg”)): # 根据文件类型替换jpg,如文件深度更深,通过添加*/解决
print(f)
dir_name = “_”.join(f.split(“/”)[-3:-1])