importer.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:tomodachi 作者: kalaspuff 项目源码 文件源码
def import_module(cls, file_name: str) -> ModuleType:
        cwd = os.getcwd()
        file_path = '{}/{}'.format(os.path.realpath(cwd), file_name)

        spec = importlib.util.spec_from_file_location(file_name, file_path)  # type: Any
        module_import = importlib.util.module_from_spec(spec)
        spec.loader.exec_module(module_import)

        return module_import
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号