Discuss / Python / 作业2

作业2

Topic source
def search_files(text, path):
    for file in os.listdir(path):
        file_path = os.path.join(path, file)
        if os.path.isdir(file_path):
            search_files(text, file_path)
        if os.path.isfile(file_path) and file.find(text) != -1:
            print(file_path)

  • 1

Reply