New submission from Chuang Men :
In pathlib, I add a parameter @case_sensitive to glob and rglob.
Sometimes the extension would be in upper case but sometimes it would be lower
case, for example: *.tif and *.TIF. So the parameter @case_sensitive may be
useful in some cases.
Usage example:
In [1]: from pathlib import Path
In [2]: path = Path('.')
In [3]: for each_file in path.glob('*.tif'):
...: print(each_file)
...:
a.tif
b.tif
In [4]: for each_file in path.rglob('*.TIF'):
...: print(each_file)
...:
c.TIF
TEST/d.TIF
In [5]: for each_file in path.glob('*.TIF', case_sensitive=False):
...: print(each_file)
...:
a.tif
c.TIF
b.tif
In [6]: for each_file in path.rglob('*.TIF', case_sensitive=False):
...: print(each_file)
...:
a.tif
c.TIF
b.tif
TEST/d.TIF
TEST/e.tif
--
components: Library (Lib)
files: pathlib.py
messages: 342284
nosy: Chuang Men
priority: normal
severity: normal
status: open
title: Add parameter @case_sensitive to glob and rglob in pathlib
type: enhancement
versions: Python 3.7
Added file: https://bugs.python.org/file48328/pathlib.py
___
Python tracker
<https://bugs.python.org/issue36898>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com