Python Fundamentals - Modules in Python

preview_player
Показать описание
What is Python Module?

A module is a file consisting of Python code. It can define functions, classes, and variables, and can also include runnable code. Any Python file can be referenced as a module.

Module vs. Function

Function: it’s a block of code that you can use/reuse by calling it with a keyword. Eg. print() is a function.

Purpose of Modules

As our program grows more in the size we may want to split it into several files for easier maintenance as well as reusability of the code. The solution to this is Modules.

We can define our most used functions in a module and import it, instead of copying their definitions into different programs. A module can be imported by another program to make use of its functionality. This is how we can use the Python standard library as well.

Types of Modules

Python provides us with some built-in modules, which can be imported by using the "import" keyword.

Python also allows us to create our own modules and use them in our programs.

How to use Modules

Built-in modules are written in C and integrated with the Python interpreter.

Each built-in module contains resources for certain system-specific functionalities such as OS management, disk IO, etc.
Рекомендации по теме
Комментарии
Автор

Sir please upload more videos on Python I learn alot from your channel

lokeshankamreddi