00:00 Modules allow you to divide a program into individual files that can be reused as needed. Related code can be organized into a single module and kept separate from other code. Packages take this organizational structure one step further.
In Python, a package is basically a folder that contains one or more Python modules. On the slide, you can see an example of a package. The structure looks like this. There is a folder named
mypackage/, and in the folder there are three Python files. One is named
module1.py, and another is named
To make a folder a regular Python package, the folder must contain an
__init__ module. The
__init__.py module doesn’t need to contain any code. It only needs to exist so that Python recognizes the
mypackage/ folder as a Python package.
Become a Member to join the conversation.