具有扩展路径连接的轻量级glob扩展。
项目描述
prodglob
os
和glob
的扩展,具有高级路径连接。
安装
pip install prodglob
使用方法
from prodglob import prodglob, pathprod, prodmake
print('pathprod: creating a product of path items.')
for f in pathprod('base', ('a', 'b'), 'something', ('c', 'd')):
print(f)
print()
print('prodglob: globbing over the product of path items.')
for f in prodglob('base', ('a', 'b'), 'something', ('c', 'd')):
print(f)
fs = pathprod('base', ('a', 'b'), 'something', ('c', 'd'))
print('how many files exist?', sum(os.path.exists(f) for f in fs))
print()
print('prodmake: making directories from the product of path items.')
fs = prodmake('base', ('a', 'b'), 'something', ('c', 'd'))
print('how many files exist?', sum(os.path.exists(f) for f in fs))
print()
print('prodglob: globbing over the product of path items.')
for f in prodglob('base', ('a', 'b'), 'something', ('c', 'd')):
print(f)
输出
pathprod: creating a product of path items.
base/a/something/c
base/a/something/d
base/b/something/c
base/b/something/d
prodglob: globbing over the product of path items.
how many files exist? 0
prodmake: making directories from the product of path items.
how many files exist? 4
prodglob: globbing over the product of path items.
base/a/something/c
base/a/something/d
base/b/something/c
base/b/something/d
项目详情
关闭
prodglob-0.0.3.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 10f29794c6206e62731842473fde63e6150642c39876a2e73e7c5c12bf00a95f |
|
MD5 | 7cd74fb2b4c553131bfc44cb482b151a |
|
BLAKE2b-256 | bb0522754cbffb4cc367bff75d94806a3b933639643da7c928248e1d3132ea55 |