On this page
  1. glob.iglob
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

glob.iglob

Prev: glob.glob | Up: glob | Next: glob.translate
Rel: glob.escape, glob.glob, glob.translate
Ref: docs.python.org — glob.iglob
Tags: #public #python3 #stdlib #glob


Import

import glob
from glob import iglob

Signature & Overview

glob.iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False, include_hidden=False)

Return an iterator which yields the paths matching a pathname pattern.

Usage

import glob
from pathlib import Path
import tempfile

with tempfile.TemporaryDirectory() as tmp:
    (Path(tmp) / "x.md").write_text("# hi")
    matches = list(glob.iglob(str(Path(tmp) / "*.md")))
    assert len(matches) == 1

Gotchas

REPL Inspect

from glob import iglob
help(iglob)

Linked from

Related notes