python3 importlib模块简单利用
importlib作用:根据字符串形式导入模块,并且找到其中的类并执行
import importlib
# m = importlib.import_module("src.plugins.nic")
# cls = getattr(m,'Nic')
# obj = cls()
# obj.process()
# v = "src.plugins.nic.Nic"
# module_path,cls_name = v.rsplit('.',maxsplit=1)
# m = importlib.import_module(module_path)
# cls = getattr(m,cls_name)
# obj = cls()
# obj.process()