Azad Rasul


9- Modules in Python

Azad Rasul's photo
Azad Rasul
·Jun 27, 2021·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

In the modules, we can use a set of functions without required to redefine them. Then, from a group of related modules, we can create a package. Create a simple module:

def hi(name):
    print("Hello, " + name)

Save it as "module1" in your directory.

Use the module:

import module1
# Hello, Ali

Built-in module

We can import various built-in modules in Python.

import platform
# Windows

Import module from a package:

import matplotlib.pyplot as plt

If you like the content, please SUBSCRIBE to my channel for the future content

Share this