Module in Python

0



module is the collection of function in python , all predefined function of python has been declared using module. it is used to logically distribute the functions into separate file.
module will be automatically created in python using filename.
for example ,if we are creating a.py file name which contains four different methods then "a" will be module.
if we want to access the method of a.py into b.py then first we will import module then call function using
import modulename  (filename)
modulename.functionname()
a.py
.................
def fun1():
    print("fun1")

def fun2():
   print("fun2")
......................................
b.py
import a    #import is the keyword to access file as a module
a.fun1()

Tags

Post a Comment

0Comments

POST Answer of Questions and ASK to Doubt

Post a Comment (0)