第二题
Topic sourcedef search_file(search_file_name=''): ist_path = os.path.abspath(".") def list_file(cur_path, file_list = None): if file_list is None: file_list = [] for file in os.listdir(cur_path): if file.find(search_file_name) > -1: file_list.append(os.path.join(cur_path, file)) if os.path.isdir(file): list_file(os.path.join(cur_path, file), file_list) L = [] list_file(ist_path, L) print('the file or dirctory in this path which name like s% are:' % search_file_name) for file in L: print(file)
- 1
UTOO_NAIVE