Azad Rasul
SmartRS

Follow

SmartRS

Follow

9- Modules in Python

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

1 min read

Play this article

In the modules, we can use a set of functions without being 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
module1.hi("Ali")
# Hello, Ali

Built-in module

We can import various built-in modules in Python.

import platform
print(platform.system())
# Windows

Import module from a package:

import matplotlib.pyplot as plt

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

To get full video tutorial and certificate, please, enroll in the course through this link: https://www.udemy.com/course/python-for-researchers/?referralCode=886CCF5C552567F1C4E7

 
Share this