import os def search(includeStr): a = os.walk(os.path.abspath('.')) while True: try: for x in next(a)[2]: if includeStr in x: print(x,os.path.abspath(x)) except StopIteration: return search(input('输入包含字符: '))
你这个不行 只能判断文件类型的文件啊,对于包含子目录的目录,直接忽略了
Sign in to make a reply
-_Rx_-