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

Question:

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

Asked By: Reza Ramezanpour

||

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.

Answered By: Karan Raj
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.