11
|
Jason Sundram Red Alert · 技术社区 · 14 年前 |
![]() |
1
7
你在Python中碰到了一个历史工件:
这比在大目录上使用内存有更多的影响。即使在只有几千个文件的目录中,也必须等待整个目录扫描完成,并且必须读取 整个的 目录,即使第一个条目是您要查找的条目。
这在Python中是一个非常明显的缺陷:似乎
不
|
![]() |
2
4
您可以尝试深入一层,并使用ctypes直接调用opendir()和readdir()。 |
![]() |
3
2
|
![]() |
4
2
我在10.6版的Apple Python 2.5.5上得到了相同的IOError,它列出了一个大目录。在Python2.6中效果很好。
os.listdir randomly fails on occasions when it shouldn't “和” Sloppy error checking in listdir() for Posix ". |