Python module vs sub-module vs package vs sub-package

Viewed 1063

In Python, What is the differences between module, sub-module, package and a sub-package?

1 Answers
package
|-- __init__.py
|-- module.py
|-- sub_package
        |-- __init__.py
        |-- sub_module.py

Consider packages and sub-packages as folders and sub-folders containing init.py file with other python files.

modules are the python files inside the package.

sub-modules are the python files inside the sub-package.

Related