Package VS Module | What Is The Difference Between Python Module And Python Package?

In this Tutorial, we will discuss the Difference Between a Python Module And a Python Package where python module can be a simple python file that we can directly use as per our choice where as the package is a collection of all the similar python modules or files which can be directly used for reference and the output of those files can be directly be used.

Packages and ModulesMoreover, we can conclude it as modules are the sub set of pythons that may contain any number of similar modules for easy convenience, and importing the package means taking all the modules used or stored there in the current program and using all the modules as per our choice whereas in case of importing a single module does not include all the other modules of package.

Package

Package in python is nothing but a collection of similar files created which can be directly used in another program as the result so that we can get result directly. A package generally contains a number of modules which are nothing but just some python files of some specific programmms.

Modules

Modules are nothing but the pyhon files which are stored at a single location that we call package where we simply normalise the files so that files related to each other are stored at a single location.

To get any particular module we need to import the package and from each package we get the desired module which we want to use in our programm

Those modules could be in built or created on the requirement basis for example follow the example given below.

from mypackage import mymodule

Here mypackage is the package where mymodule is the module which we use for direct use.

 

To learn more about What Is The Difference Between Python Module And Python Package visit: Python Packag and Module.

Visit to learn more about python at Some Basic Python String Programs-4.

 

Leave a Comment

%d bloggers like this: