引入模組¶
The modules described in this chapter provide new ways to import other Python modules and hooks for customizing the import process.
The full list of modules described in this chapter is:
zipimport
--- 從 Zip 封存檔案匯入模組pkgutil
--- 套件擴充工具程式modulefinder
--- 搜尋腳本所使用的模組runpy
--- 定位並執行 Python 模組importlib
---import
的實作- 簡介
- 函式
importlib.abc
-- Abstract base classes related to importimportlib.machinery
-- Importers and path hooksSOURCE_SUFFIXES
DEBUG_BYTECODE_SUFFIXES
OPTIMIZED_BYTECODE_SUFFIXES
BYTECODE_SUFFIXES
EXTENSION_SUFFIXES
all_suffixes()
BuiltinImporter
FrozenImporter
WindowsRegistryFinder
PathFinder
FileFinder
SourceFileLoader
SourcelessFileLoader
ExtensionFileLoader
NamespaceLoader
ModuleSpec
AppleFrameworkLoader
importlib.util
-- Utility code for importers- 範例
importlib.resources
-- 套件資源的讀取、開啟與存取importlib.resources.abc
-- 資源的抽象基底類別importlib.metadata
-- 存取套件的元資料sys.path
模組搜尋路徑的初始化