March 2003
Intermediate to advanced
656 pages
39h 30m
English
listdir
listdir(path)Returns a list whose items are the names of all files and
subdirectories found in directory path.
The returned list is in arbitrary order, and does not include the
special directory names '.' and
'..‘.
The dircache module also supplies a function named
listdir, which works like
os.listdir, with two enhancements. First,
dircache.listdir returns a sorted list. Further,
dircache caches the list it returns, so repeated
requests for lists of the same directory are faster if the
directory’s contents have not changed in the
meantime. dircache automatically detects changes,
so the list that dircache.listdir returns is
always up to date.