I want to get dir list of current dir only (no recursion).
Also, I have mount point /mnt/test0
with ext4
.
I do:
>>> [x for x in os.listdir('/mnt/test0/base/trash') if os.path.isdir(x)] []
/mnt/test0/base/trash
has one dir test
, however list
is empty.
If I do:
>>> [x for x in os.listdir('/mnt/test0/base/trash')]
It's here.
>>> [x for x in os.listdir('/mnt/test0/base/trash')] ['test']
Linux ls
:
# ls -lA total 28 drwxrwx--- 9 root root 28672 Nov 11 23:00 test
What is the strange bug of os.path.isdir(x)
?
没有评论:
发表评论