Skip to main content
 首页 » 编程设计

python之如何在 Python3 中找到 os.scandir 的源代码

2024年12月31日10xiaohuochai

这和我的 another question 有点关系.

在所有获取函数源的方法中:

  • getsource 不工作
  • os.scandir 没有__file__ 属性,所以你不能只是os.scandir.__file__。
  • 扫描source file in python github repo没有发现任何有趣的东西。

如有任何建议,我们将不胜感激。

请您参考如下方法:

From the documentation :

On Unix-based systems, scandir() uses the system’s opendir() and readdir() functions. On Windows, it uses the Win32 FindFirstFileW and FindNextFileW functions.

如果您想了解幕后发生的事情,我建议您查看这些内容。