mark at mceahern.com
Sun Jan 25 23:51:24 CET 2004
On Sun, 2004-01-25 at 16:25, Uwe Mayer wrote:
> is there for python a find() function, like the perl module Find or the
> command line tool find?
pattern = '*.pyc'
for name in glob.glob(pattern):
glob's not recursive, though. For that, consider os.walk:
path = '.'
extensions = ('.pyc',)
for root, dirs, files in os.walk(path):
for name in files:
prefix, ext = os.path.splitext(name)
if ext not in extensions:
fullname = os.path.join(root, name)
The above code may have syntax errors since I didn't run it.
More information about the Python-list