searching for files on Windows with Python

Peter Hansen peter at engcorp.com
Thu Nov 17 23:02:01 EST 2005


Kent Johnson wrote:
> I always use Jason Orendorff's path module for this kind of stuff. It's 
> way easier to use than os.whatever:
> 
> import path
> files = path.path(pathToSearch).walkfiles(filename)

A minor enhancement (IMHO) (though I certainly agree with Kent's 
recommendation here): since there is nothing else of interest in the 
"path" module, it seems to be a fairly common idiom to do "from path 
import path" and skip the doubled "path.path" bit.

-Peter



More information about the Python-list mailing list