标签:导入模块 rtl get 根据 model auth code style getattr
path = "auth.my_auth.AUTH" # 根据path实例化AUTH类
path = "auth.my_auth.AUTH" import importlib model_path, class_name = path.rsplit(".", 1) model = importlib.import_module(model_path) # 根据"auth.my_auth"导入my_auth模块 obj = getattr(model, class_name)() # 反射并实例化
标签:导入模块 rtl get 根据 model auth code style getattr
原文地址:https://www.cnblogs.com/zxc-Weblog/p/9120755.html