OS 使用 Python 快速查找文件的独立方法

OS independent method to find a file fast with Python

使用Python,如何在目录(包括子目录)中搜索文件快?

此处的标准答案使用 os.walk(),如果在 Linux 下工作,与仅调用 find /path -iname "*string*" 相比速度较慢。

是否有一种独立于平台的干净方式来实现更快的速度?

os.scandir (GitHub) is faster than os.walk and is now in the Python 3.5+ standard library.