Sometimes we have to use someone else's code in our program because it saves us a lot of time. Today, we will learn a technique to use code that is not written by us but will enhance the quality of our program, save us time, and of course, it is legal and free.
Let us understand what utilities like modules and pip are,
Module – Module or library is a file that contains definitions of several functions, classes, variables, etc. which is written by someone else for us to use.
Pip – Pip is a package manager for Python i.e., pip command can be used to download any external module in Python. It is something that helps us to get code written by someone else from somewhere.
We can install a module in our system by using pip command :
Example, for installing flask I will do this:
After pressing the enter key, you will see something like this:
After installing any module in Python, you can import it into your program or your Python projects. For example, to use flask, I will type "import flask" at the top of my Python program.
There are two types of modules in Python:
Built-in modules are the modules that 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, os, etc.
To get a complete list of built-in modules of python head to the following page of the official documentation - https://docs.python.org/3/py-modindex.html.
These are the modules that are not pre-installed in Python i.e., we need to download them before using them in our program.
Example – Flask, Pandas, TensorFlow, etc.
That's all about modules in Python. I hope you are enjoying this course. Please make sure to subscribe to CodeWithHarry on YouTube if you think my efforts and this content is helpful.
Amazing Sir !
Hello! I wanna need cheats list for C++ programing Please Can you send or share with me Kindly,thanks for you I am Raheel from Pakistan
Full Notes and Source Code: https://github.com/Optimized-World/Complete-Python-Tutorial-and-Notes
Thank you for helping us Bhai.
sir, I'm facing problems as i type pip install flask
harry bhai i m getting error while downloading "pip install flask" The script flask.exe is installed in 'c:\python371\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Any Course related announcements will be posted here