import os def find_files(name,rootDir): for list in os.listdir(rootDir): path = os.path.join(rootDir,list) if os.path.isfile(path) and name in list: print(path) if os.path.isdir(path): find_files(name,path)
Sign in to make a reply
不会潘岩
import os def find_files(name,rootDir): for list in os.listdir(rootDir): path = os.path.join(rootDir,list) if os.path.isfile(path) and name in list: print(path) if os.path.isdir(path): find_files(name,path)