我是靠谱客的博主 大意麦片,这篇文章主要介绍python importlib详解,Python importlib.abc方法代码示例,现在分享给大家,希望可以做个参考。

# 需要导入模块: import importlib [as 别名]

# 或者: from importlib import abc [as 别名]

def open_module(self, event=None):

# XXX Shouldn't this be in IOBinding?

try:

name = self.text.get("sel.first", "sel.last")

except TclError:

name = ""

else:

name = name.strip()

name = tkSimpleDialog.askstring("Module",

"Enter the name of a Python modulen"

"to search on sys.path and open:",

parent=self.text, initialvalue=name)

if name:

name = name.strip()

if not name:

return

# XXX Ought to insert current file's directory in front of path

try:

spec = importlib.util.find_spec(name)

except (ValueError, ImportError) as msg:

tkMessageBox.showerror("Import error", str(msg), parent=self.t

最后

以上就是大意麦片最近收集整理的关于python importlib详解,Python importlib.abc方法代码示例的全部内容,更多相关python内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(129)

评论列表共有 0 条评论

立即
投稿
返回
顶部