Please enable JavaScript.
Coggle requires JavaScript to display documents.
9: Modules &
Packages - Coggle Diagram
9: Modules &
Packages
-
Modules &
Packages
modules
-
-
is python file or another file which is written on other languages -> called extension module -> use to save external library
import
statement:
-
import multiple files at the same time: import a, b, c (should limited) -> instead that we will do:
import a
import b
import c
-
although "import" statements are called many times, but it only execute 1 time
-
-
from import
statement
import more than one attribute, method ->
import attributes, methods
-
although "import" statements are called many times, but it only execute 1 time
-
-
-
packages
import a
package
-
can import a package but shouldn't because can't access any module on that package, can do that through init.py file
-
is a folder which contains modules, sub package and init.py file
all variable
-
syntax: all = ['module_a',]
classify some module groups, each module group has one its folder
special
variables
name
-
If the source file is executed as the main program, the interpreter sets the name variable to have a value “main”
-