Getting all the *files* from a directory -- A better way??
pj at sgi.com
Wed Mar 28 22:30:58 CEST 2001
|> files = [os.path.join(dir, f) for f in os.listdir(dir)
|> if os.path.isfile(f)]
|> If you do the map() with a list comprehension, why not the filter() as well.
I doubt this will work. The condition:
will fail to test the right path. You have to test "a/b/c/f",
not "f". Only by first changing directory to "a/b/c" would
the above work.
I won't rest till it's the best ...
Manager, Linux System Software
Paul Jackson <pj at sgi.com> 1.650.933.1373
More information about the Python-list