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

nanotech at europa.com nanotech at europa.com
Wed Mar 28 00:36:24 CEST 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