class X1:
m1 = 1
class X2:
m2 = 11
class myF:
def get_instance(self,inis): # ini 输入 类名
return inis()
mf = myf()
res1 = X1()
res2 = mf.get_instance(X1)
print(res1.a)
print(res2.a)
"""
3
3
"""
小结:
测试传入类名
reference:
https://www.cnblogs.com/sunzebo/p/9563725.html