Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
oorrja
GitHub Repository: oorrja/learntosolveit
Path: blob/master/languages/python/algorithm_locate.py
1240 views
1
import fnmatch
2
import os
3
4
def locate(pattern, root=os.getcwd()):
5
for path, dirs, files in os.walk(root):
6
for filename in [os.path.abspath(os.path.join(path, filename)) for filename in files if fnmatch.fnmatch(filename, pattern)]:
7
yield filename
8
9