[issue11406] There is no os.listdir() equivalent returning generator instead of list

Serhiy Storchaka report at bugs.python.org
Sun Mar 11 20:13:51 CET 2012


Serhiy Storchaka <storchaka at gmail.com> added the comment:

> On Unix, doing os.stat
> on the directory, then looking on st_nlink, will tell you whether
> the directory is empty (st_nlink is 2 on an empty directory).

Directory with st_nlink==2 can contains any number of non-directory files. And one subdirectory if this directory is root.

----------
nosy: +storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11406>
_______________________________________


More information about the Python-bugs-list mailing list