Mastery14 – Creating a python module

creating a module is no different from a normal program, create a python file and create a few functions in it.

file name: mymodule.py

def function1():

      print (“function 1”)

# end of the module.

and in another program import it an call the function:

import mymodule.py

mymodule.function1()

reference:

http://www.ibiblio.org/g2swap/byteofpython/read/making-modules.html

CC BY 4.0 Mastery14 – Creating a python module by sergio is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.