I want to be able to match a pattern in glob format to a list of strings, rather than to actual files in the filesystem. Is there any way to do this, or convert a glob
On Python 3.4+ you can just use PurePath.match.
pathlib.PurePath(path_string).match(pattern)
On Python 3.3 or earlier (including 2.x), get pathlib from PyPI.
Note that to get platform-independent results (which will depend on why you're running this) you'd want to explicitly state PurePosixPath
or PureWindowsPath
.