Filesystem and I/O Modules
glob
Finds existing pathnames matching shell-style patterns. Use recursive=True with ** for recursive searches and sort results when order matters. Hidden-name handling differs from pathlib globbing. Searches can traverse large trees; constrain the root and pattern.
Formal Syntax & Structure
python syntaxpython
import globReturn Value
module
Module namespace available through import; import is a statement, not a value-returning expression.
Working Example
Example Snippetpython
import globfrom pathlib import Pathfrom tempfile import TemporaryDirectorywith TemporaryDirectory() as folder: for name in ("b.txt", "a.txt", "c.csv"): (Path(folder)/name).touch() print(sorted(glob.glob("*.txt", root_dir=folder)))