Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试ls使用通配符实现命令,?并且*不使用 glob 函数。我将实现我自己的匹配通配符模式的路径生成器。但我不知道从哪里开始。首先,我需要遍历目录。如何遍历目录以匹配包含通配符的模式字符串。例如,假设模式是*/*。我必须遍历directories/entires然后检查模式字符串是否与使用的遍历路径匹配fnmatch()。而且有很多可能的情况,../*/*, */../*, */,*/*/*.out等。 有什么有用的链接吗?任何帮助都是极好的。
ls
?
*
*/*
directories/entires
fnmatch()
../*/*
*/../*
*/
*/*/*.out