Using Modules & Pip In Python

Sometimes we have to use someone else’s code in our program because it saves our lot of time and off-course it is legal and free.


Module – Module or library is the file which contain definitions of several functions, classes, variables, etc. which are written by someone else for free use.


Pip – Pip is a package manager in python i.e. pip command is used to download any external module in python. It is something like which helps us to get something from somewhere.


We can install any module in our system by pip command :

  • Simply open cmd or Powershell in your system.
  • And then type pip install module_name and press enter.
  • After that the module will start downloading and will install automatically in your computer.


->

After installing any module in python you can import it in your program or in your project of Python.

              

There are 2 types of modules in Python :

  • Built-in Modules -

Built-in modules are those modules which are pre-installed in python i.e. there is no need to download them before using. These modules come with python interpreter itself.

Example – random module, winreg, etc.

To get complete list of built-in modules of python - https://docs.python.org/3/py-modindex.html


  • External Modules

These are those modules which are not pre-installed in python i.e. we need to download them before using in our program.

Example – Flask, Panda, etc.


That's all about modules in Python.

Python


Comments(2)

Raheel123 at 2019-06-23 09:30:09 says
Amazing Sir !
harry at 2019-06-23 09:30:09 says
Thanks!