Glob module
A library module that finds filesystem pathnames matching shell-style wildcard patterns.
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
- Pro ASP.NET Core 7, Tenth Edition
- Pandas Workout: 200 exercises to make you a stronger data analyst
- The Well-Grounded Rubyist, Fourth Edition
- Python How-To
- Data Pipelines with Apache Airflow, Second Edition
What to know first
- minimum valueA minimum value is the least value in a set or collection according to the applicable comparison rules.
- maximumA maximum is the greatest element in a collection or range under a specified ordering.
- PythonPython is a high-level, general-purpose, dynamically typed programming language with readable syntax and support for multiple programming paradigms.
- tupleA tuple is a finite, ordered collection of values grouped as a single composite value, often with elements of different types.
Related concepts
- os.listdiralternative to · os.listdir is a Python standard-library function that returns the names of entries in a specified filesystem directory.
- Dir#entriesalternative to · Dir#entries is a Ruby method that returns the entries of a directory as an array.
- DirectoryLoaderused by · DirectoryLoader is a LangChain document-loading component that discovers files in a directory and delegates format-specific extraction to an underlying loader.
- FileSensorused by · FileSensor is an Airflow sensor that checks whether a file exists at a specified path.
- pathlibused by · pathlib is a Python standard-library module providing object-oriented classes and operations for representing and manipulating filesystem paths.
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.


