Python/pathlib/PurePath/match
التابع PurePath.match
Match this path against the provided glob-style pattern. Return True if matching is successful, Falseotherwise.
If pattern is relative, the path can be either relative or absolute, and matching is done from the right:
>>> 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
If pattern is absolute, the path must be absolute, and the whole path must match:
>>> PurePath('/a.py').match('/*.py')
True
>>> PurePath('a/b.py').match('/*.py')
False
As with other methods, case-sensitivity is observed:
>>> PureWindowsPath('b.py').match('*.PY')
True