摘要: def list_submodules(self,package_path): """递归地列出给定包路径下的所有子模块""" all_submodules = [] # 遍历包路径下的所有文件/目录 for importer, modname, ispkg in pkgutil.iter_modu 阅读全文
posted @ 2024-03-10 20:27 朵朵奇fa 阅读(100) 评论(0) 推荐(0) 编辑
摘要: import importlib.util def import_module_by_path(module_path,module_name): """ 根据给定的完整路径动态导入模块 """ spec = importlib.util.spec_from_file_location(module 阅读全文
posted @ 2024-03-10 20:26 朵朵奇fa 阅读(166) 评论(0) 推荐(0) 编辑