一个python类,其类路径字符串是student.Student class Student: name = 'admin' age = 12 通过如下方式就能获取到类的属性及其属性值 import importlib # 类的全路径 path = 'student.Student' p,c = path.rsplit('.',maxsplit=1) m = importlib.import_module(p) # 类的cls cls = getattr(m,c) # print(cls) # for key in dir(cls