importlib.util.resolve_name()

importlib.util.resolve_name(name, package)

Resolve a relative module name to an absolute one.

If name has no leading dots, then name is simply returned. This allows for usage such as importlib.util.resolve_name('sys', __package__) without doing a check to see if the package argument is needed.

ValueError is raised if name is a relative module name but package is a false value (e.g. None or the empty string). ValueError is also raised a relative name would escape its containing package (e.g. requesting ..bacon from within the spam package).

New in version 3.3.

doc_python
2016-10-07 17:34:53
Comments
Leave a Comment

Please login to continue.