python 模糊找文件例子
import os
def search_file(path,keyword):
for cur_path,dirs,files in os.walk(path):
for file_name in files: #xx.mp4
if keyword in file_name:
abs_path = os.path.join(cur_path,file_name)
print("查找到 %s,绝对路径是 %s" % (file_name,abs_path))
search_file("/Users/dj/work/python/automation/fmz_code/day5/作业/",".log")

浙公网安备 33010602011771号