On 08/19/2012 03:29 PM, Selby Rowley Cannon wrote:
> OK, I have some code, and it uses glob.glob('*.py') to find all the
> python files in the current directory.
> Just thought i'd ask, would:
>
> glob.glob('C:\*.py') (Windows), or
>
> glob.glob('/*.py') (*nix)
>
> find all the python files on the system? ThanksSee http://docs.python.org/library/glob.html I don't see anywhere it implies that more than one directory would be scanned. In any case, it's pretty quick to just try it in the interpreter. I tried using python 2.7 on Linux, and it does not descend recursively into subdirectories. Perhaps you want os.walk, which lets you loop over an entire tree of files/directories. BTW, you forgot to double the backslash in your Windows example. Either double the backslash, or make it a raw string, or use forward slashes. -- DaveA _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
