根据字符串导入包使用-----importlib

import importlib
o = importlib.import_module("xx.oo")
s2 = "Person"
the_class = getattr(o,"Person")
the_class()
posted @ 2019-03-22 12:20  刀锋意志1  阅读(245)  评论(0编辑  收藏  举报