Miles Stevenson wrote:
What is interesting is that the latest 2.4 Python docs say that walk() returns a Tuple, which is untrue.
It returns a generator object according to type(). This had me heavily confused as to how to use
what was returned from walk() and it took a good hour of troubleshooting
Thanks for the advice! My problem was that the built-in Python docs in Kdevelop
weren't up-to-date, and
I had trouble finding walk() in the docs. Here is the approach that I used
being a python newbie
(improvements are welcome):
def getfiles(path):
"""Recursively search a path and genera
Try this
def findfile(thefile,
toplevel="C:\\windows",findcount=-1,subdirectories=True,returnlist=False):
results = []
t = 0
if subdirectories:
for root,dirs,files in os.walk(toplevel):
for x in files:
fullname = os.path.join(root,x)
if x.lo
Try the os module. I think this should probably get you there.
http://docs.python.org/lib/module-os.html
Miles Stevenson wrote:
>I would like to search filesystem structures using globs on Posix
systems from
>within Python. I don't see an obvious method to do this with in the
standard
>modules
I would like to search filesystem structures using globs on Posix systems from
within Python. I don't see an obvious method to do this with in the standard
modules. What is the preferred way of doing this? Should I just use the find
command or is there a good module out there for searching?
Tha