递归找文件夹
import os def check_inpath(path, dir): path_dir = os.listdir(path) for dir_scn in path_dir: path_join = os.path.join(path, dir_scn) if os.path.isdir(path_join): if path_join == os.path.join(path, dir): return path_join else: ret = check_inpath(path_join, dir) if ret:return ret current = r'D:\Python27\Day10\ftp作业3\server' target = 'ccc' print(check_inpath(current, target))