PEP ? os.listdir enhancement

Jeff Epler jepler at
Wed Jun 22 18:27:06 CEST 2005

Why not just define the function yourself?  Not every 3-line function
needs to be built in.

def listdir_joined(path):
    return [os.path.join(path, entry) for entry in os.listdir(path)]

dirs = [x for x in listdir_joined(path) if os.path.isdir(x)]

path_size = [(x, getsize(x)) for x in listdir_joined(path) if os.path.isfile(x)]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list