liveBook · Manning

Glob module

A library module that finds filesystem pathnames matching shell-style wildcard patterns.

How 3 Manning books explain it

Python Workout, Second Edition

glob is a Python standard-library module for finding pathnames that match shell-style wildcard patterns.

How it is used
Selects files by shell-style pathname patterns when processing a directory’s matching files.
How deep it goes
Explains glob.glob usage and contrasts it with os.listdir and pathlib, without detailing wildcard semantics beyond * and ?.
Examples
Uses /etc/*.conf for configuration files and scores/*.json for selecting class score files.
What you can do after
Apply it via glob.glob to gather matching pathnames for subsequent file processing.

Read how Python Workout, Second Edition explains glob module →

Python Workout: 50 ten-minute exercises

glob is a Python standard-library module for finding filesystem pathnames that match shell-style wildcard patterns.

How it is used
Finds selected filesystem pathnames for subsequent file processing.
How deep it goes
Defines wildcard matching and demonstrates iteration, but defers detailed pattern syntax and implementation internals.
Examples
Uses scores/*.json and /etc/*.conf to select matching files.
What you can do after
Apply it via Python's glob.glob function to iterate over files matching a pathname pattern.

Read how Python Workout: 50 ten-minute exercises explains glob module →

The Quick Python Book, Fourth Edition

The glob module is a Python standard-library module that finds filesystem pathnames matching shell-style wildcard patterns.

How it is used
Finds filesystem pathnames matching shell-style wildcard patterns.
How deep it goes
Defines three wildcard forms and demonstrates their outputs, but does not discuss more complex matching requirements.
Examples
Demonstrates *, *json, ?.tmp, and [0-9].tmp against sample directory contents.
What you can do after
Apply it via glob.glob to collect filesystem names matching reusable wildcard patterns.

Read how The Quick Python Book, Fourth Edition explains glob module →

Also covered in

What to know first

Related concepts

Questions about glob module

What is glob module?

A library module that finds filesystem pathnames matching shell-style wildcard patterns.

Which Manning books explain glob module?

Python Workout, Second Edition, Python Workout: 50 ten-minute exercises and The Quick Python Book, Fourth Edition.

What should I know before learning glob module?

Manning books that teach glob module usually introduce minimum value, maximum, Python and tuple first.

What is the difference between glob module and os.listdir?

A library module that finds filesystem pathnames matching shell-style wildcard patterns. os.listdir is a Python standard-library function that returns the names of entries in a specified filesystem directory.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.