Discuss / Python / 满足要求,应该占用资源最小?

满足要求,应该占用资源最小?

Topic source

-_Rx_-

#1 Created at ... [Delete] [Delete and Lock User]
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('输入包含字符: '))

十夢玖祢i

#2 Created at ... [Delete] [Delete and Lock User]

你这个不行 只能判断文件类型的文件啊,对于包含子目录的目录,直接忽略了


  • 1

Reply