Python os.walk(...,followlinks=True) 在 WINdows (Vista) 中工作吗? [英] Does Python os.walk(...,followlinks=True) work in WIndows (Vista)?
问题描述
我有一个简单的目录,只包含 2 个指向其他目录的链接.os.walk 不会进入它们,它报告 2 个文件和 0 个目录.我注意到文档指的是符号链接",我怀疑这是一个 Unix 术语,而不是 MS,但我不确定.或者还有什么我遗漏的吗?
I have a simple directory containing just 2 links to other directories. os.walk does not walk into them, it reports 2 files and 0 directories. I note the docs refer to "symlink" which I suspect is a Unix term not MS but Im not sure. Or is there something else im missing?
[Vista Pro 上的 Python 2.7]
[Python 2.7 on Vista Pro]
推荐答案
它不适用于 Windows(至少在 Windows 7 中).
It does not work on Windows (at least in Windows 7).
followlink
依赖于 os.islink
、os.isdir
.但是两者都为 Windows 中的链接目录返回 False
(在 Python 2.7 中).
followlink
depends on os.islink
, os.isdir
. But both returns False
for Link directory in windows (in Python 2.7).
顺便说一句,在 Python 3.2+ 中,os.islink
为符号链接返回 True
.但是 os.isdir
仍然返回 False
.os.walk
也不起作用.
BTW, in Python 3.2+, os.islink
return True
for symlinks. But os.isdir
still return False
. os.walk
does not work neither.
请参阅使用 python 的 windows 上的 os.path.islink.
这篇关于Python os.walk(...,followlinks=True) 在 WINdows (Vista) 中工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!