📜  如何从 os 模块查看目录 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:18.010000             🧑  作者: Mango

代码示例4
import pathlib

# define the path
currentDirectory = pathlib.Path('.')

# define the pattern
currentPattern = "*.py"

for currentFile in currentDirectory.glob(currentPattern):
    print(currentFile)