zhzhang

 

# -*- coding: utf-8 -*-
# author:baoshan

import os

dirname = r\'D:\0.shenma\01.聊城资料\01.数据资料\02.聊城年鉴数据\2017年鉴\'
filename = ".xls"

result = []
def search(dirname=dirname, filename=""):
    for item in os.listdir(dirname):
        item_path = os.path.join(dirname, item)
        if os.path.isdir(item_path):
            search(item_path, filename)
        elif os.path.isfile(item_path):
            if filename in item:
                global result
                result.append(item_path +";")
                print(item_path+";")


if __name__ == \'__main__\':
    search(dirname, filename)

 

 

转自:https://www.cnblogs.com/hyacinthwyd/p/8997917.html

 

谢谢!

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2021-06-29
猜你喜欢
  • 2022-12-23
  • 2021-12-21
  • 2022-03-08
  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
  • 2021-11-18
相关资源
相似解决方案