Modules
Modules
What is a Module?
Use a Module
mymodule.greeting("Jonathan")
Note: When using a function from a module, use the
syntax: module_name.function_name.
Variables in Module
The module can contain functions, as already described, but also variables of all types
(arrays, dictionaries, objects etc):
Import the module named mymodule, and access the person1 dictionary:
import mymodule
a = mymodule.person1["age"]
print(a)
:
Re-naming a Module
print (person1["age"])