![]() |
how to create module in python |
What are the modules in python?
Modules is a block of code which will contain definitions and statements
Modules can contain functions ,classed and variables
Module contain just normal code that's call one type of module for example we have one file Test.py where Test is module name
How To Create Module ?
To create a module just save the code with .py extension
Example
def Module(val1,val2):
# this program is add two number
Sum = val1 + val2
print(Sum)
Here we create Test.py module that contain the two value and its sum
for use of test module we will import in our project
How to import modules ?
Now we used the create Test.py module, By using just import keyword to use them
Example
Import Test
Test.Module(20,30)
Output
50
Python Modules List
Numpy
Pandas
Seaboarn
Requests
Selenium
Pygame
pySonic
Py2exe
pyquery
GDmodule
SciPy
Matplotlib
MoviePy
pyscreenshot