python-----模糊搜索文件

Posted 小呆丶

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python-----模糊搜索文件相关的知识,希望对你有一定的参考价值。

  • 告诉计算机文件在哪  →  使用路径描述位置
  • 描述文件的特征  →  用条件判断来筛选
  • 比对后打印文件名  →  用循环来实现逐个比对
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2019/1/21 18:57
# @Author  : xiaodai
import os
path = rF:	emp	est
files = os.listdir(path)
for f in files:
    if f.endswith(.png) and fish in f:
        print(Look! I found this 
+f)

 

以上是关于python-----模糊搜索文件的主要内容,如果未能解决你的问题,请参考以下文章