Creating and using a Python module
A module is a file containing Python definitions and statements. The file name is the module name with the suffix “.py”
Example:
- Create “hello.py” then write the following function:
def helloworld():
print "hello"
import hello
hello.helloworld()
>>>'hello'
Mastery14 by Joel Erles is licensed under a Creative Commons Attribution 4.0 International License.