Chapter 19. Modules and Packages

Python’s primary extension mechanism uses source code saved to modules and incorporated into a program through the import statement. The features that most developers think of as “Python” are actually implemented as the collection of modules called the standard library, the subject of this book. Although the import feature is built into the interpreter itself, there are several modules in the library related to the import process.

The imp module exposes the underlying implementation of the import mechanism used by the interpreter. It can be used to import modules dynamically at runtime, instead of using the import statement to load them during start-up. Dynamically loading modules is useful when the name of a ...

Get The Python Standard Library by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.