Tools, FAQ, Tutorials:
'import' Module Package Loading Statement
How to use "import" statement to load Python module packages?
✍: FYIcenter.com
 If you created a Python module package directory called "firstPackage" as described in the previous tutorial, 
you can load it into your Python execution session using the "import" statement:
If you created a Python module package directory called "firstPackage" as described in the previous tutorial, 
you can load it into your Python execution session using the "import" statement:
1. Make sure the module package directory is a sub directory of the current directory:
\fyicenter>dir <DIR> firstPackage
2. Start the Python in interactive mode:
\fyicenter>python Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:14:34) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
3. Load the module package. Note that the Python code in the __init__.py file will be executed once when you load the package directory for the first time. If you load it again, it will not be executed any more.
>>> import firstPackage Loading first package... >>> import firstPackage
4. If you want to load module inside a package, you need to load it using the dot (.) expression format:
>>> import firstPackage.secondModule Loading second module...
⇒ 'sys' Module - System Parameters and Functions
2022-08-26, ∼1710🔥, 0💬
Popular Posts:
How To Break a File Path Name into Parts in PHP? If you have a file name, and want to get different ...
How To Use an Array as a Queue in PHP? A queue is a simple data structure that manages data elements...
How to install "The Windows SDK version 8.1"? I need to build my Visual Studio C++ applications. If ...
How to use the RSS Online Validator at w3.org? You can follow this tutorial to learn how to use the ...
How to add request URL Template Parameters to my Azure API operation 2017 version to make it more us...