探路者操作系统。为人类行走

pathfinder的Python项目详细描述


https://travis-ci.org/jkeyes/pathfinder.png?branch=master

查找文件路径的实用程序。

示例

from pathfinder import find

# get all directories and sub-directories in current directory
paths = find(".", just_dirs=True)

# get all files in the current directory and all sub-directories
paths = find(".", just_files=True)

# get all jpg files using a regex
paths = find(".", regex=".*\.jpg$")

# get all jpg files using posix wildcards
paths = find(".", fnmatch="*.jpg")

# get all jpg files and png files
from pathfinder import FnmatchFilter
from pathfinder import OrFilter
jpg_filter = FnmatchFilter("*.jpg")
png_filter = FnmatchFilter("*.png")
gif_filter = FnmatchFilter("*.gif")
image_filter = OrFilter(jpg_filter, png_filter, gif_filter)
paths = find(".", filter=image_filter)

# shortcut using bitwise or
paths = find(".", filter=jpg_filter | png_filter | gif_filter)

# even shorter using ImageFilter to find all images
from pathfinder import ImageFilter
paths = find(".", filter=ImageFilter())

# and an even shorter way
paths = ImageFilter().find(".")

安装

要安装探路者,只需:

$ pip install pathfinder

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java ArrayIndexOutOfBoundsException,但不访问任何索引   用JAVA代码复制的奇怪结果   基于当前用户的Java目标目录   运行时错误java scanner不接受中间有空格的两个单词   java Android从editText获取文本   枚举内的java搜索   java自定义布局高度包装内容,而不是使用定义的布局高度   Java 5中引入的Enum类的用途是什么?   excel如何在java swing中查看xls文档   java如何模拟影响对象的void返回方法   Java线程之间的多线程数据交换   JavaSpring引导:库是否会从父应用程序/服务获取依赖关系   java经过一段时间的循环:为什么刚刚写入的数组是空的?   Regex和java忽略引号内的关键字和字符串   oracle我正在从java读取文本文件(逗号作为分隔符)