PyDocs

Nav

File and Directory Access

PurePath.match

pathlib

method of PurePath (source)
  • PurePath.match(pattern, *, case_sensitive=None)
Return True if this path matches the given pattern. If the pattern is
relative, matching is done from the right; otherwise, the entire path
is matched. The recursive wildcard '**' is *not* supported by this
method.
Changed in 3.12
  • 3.12: The pattern parameter accepts a path-like object.
  • 3.12: The case_sensitive parameter was added.
1 Example
>>> PurePath('a/b.py').match('*.py')
True
>>> PurePath('/a/b/c.py').match('b/*.py')
True
>>> PurePath('/a/b/c.py').match('a/*.py')
False
from the Python docs
See Also
No see-alsos for pathlib/PurePath.match
0 Notes
No notes for PurePath.match