本モジュールは、import文の実装に使用されているメカニズムへの インターフェースを提供します。以下の定数と関数を定義しています:
If search is successful, the return value is a triple (file, pathname, description) where file is an open file object positioned at the beginning, pathname is the pathname of the file found, and description is a triple as contained in the list returned by get_suffixes() describing the kind of module found. If the module does not live in a file, the returned file is None, filename is the empty string, and the description tuple contains empty strings for its suffix and mode; the module type is as indicate in parentheses dabove. If the search is unsuccessful, ImportError is raised. Other exceptions indicate problems with the arguments or environment.
This function does not handle hierarchical module names (names containing dots). In order to find P.M, i.e., submodule M of package P, use find_module() and load_module() to find and load package P, and then use find_module() with the path argument set to P.__path__. When P itself has a dotted name, apply this recipe recursively.
If the load is successful, the return value is the module object; otherwise, an exception (usually ImportError) is raised.
Important: the caller is responsible for closing the file argument, if it was not None, even when an exception is raised. This is best done using a try ... finally statement.
The following constants with integer values, defined in this module, are used to indicate the search result of find_module().
The following constant and functions are obsolete; their functionality is available through find_module() or load_module(). They are kept around for backward compatibility:
guido@python.org