Staging
v0.5.1
https://github.com/python/cpython
Revision 0ffdd05cc331a7c743439188a89c44320b796a59 authored by Guido van Rossum on 05 April 1999, 21:54:14 UTC, committed by Guido van Rossum on 05 April 1999, 21:54:14 UTC
#else/#endif are wrong, and that #if HAVE_TM_ZONE should be #ifdef.
1 parent 93aa0f2
Raw File
Tip revision: 0ffdd05cc331a7c743439188a89c44320b796a59 authored by Guido van Rossum on 05 April 1999, 21:54:14 UTC
Jonathan Giddy notes, and Chris Lawrence agrees, that some comments on
Tip revision: 0ffdd05
find.py
import fnmatch
import os

_debug = 0

_prune = ['(*)']

def find(pattern, dir = os.curdir):
	list = []
	names = os.listdir(dir)
	names.sort()
	for name in names:
		if name in (os.curdir, os.pardir):
			continue
		fullname = os.path.join(dir, name)
		if fnmatch.fnmatch(name, pattern):
			list.append(fullname)
		if os.path.isdir(fullname) and not os.path.islink(fullname):
			for p in _prune:
				if fnmatch.fnmatch(name, p):
					if _debug: print "skip", `fullname`
					break
			else:
				if _debug: print "descend into", `fullname`
				list = list + find(pattern, fullname)
	return list
back to top