Is there any built-in or easy way to recursively match paths with a double asterisk, for example. for example zsh does?
For example, when
path = 'foo/bar/ham/spam/eggs.py'
I can use fnmatch to check it with
fnmatch(path, 'foo/bar/ham/*/*.py'
Although, I would like to be able to:
fnmatch(path, 'foo/**/*.py')
I know that fnmatch matches its pattern with a regular expression , so in the case of words, I can collapse my own fnmatch with an additional pattern **but maybe there is an easier way
source
share