Getting all the *files* from a directory -- A better way??

nanotech at europa.com nanotech at europa.com
Tue Mar 27 17:36:24 EST 2001


All:

Here is how I get all the files from a directory:

  dir="a/b/c"
  files=filter(os.path.isfile,["%s/%s"%(dir,f) for f in os.listdir
(dir)])

Is this *REALLY* the Pythonic way to do this? (OR, why does
os.listdir return only file names, and not the path given
prepended?)

Quentin Crain






More information about the Python-list mailing list