###特殊创建类

# class Foo (object):
# def __init__(self,name):
# self.name = name
#
# C = Foo("Caicai")
# print(type(C))


###特殊创建类
def func(self):
print("Hello %s you and %s"%(self.name,self.age))

def __init__(self,name,age):
self.name = name
self.age = age

Foo = type("Foo",(),{"func":func,"__init__":__init__})
foo = Foo("Caicai","22")
foo.func()
print(type(Foo))


猜你喜欢

转载自www.cnblogs.com/ArtisticMonk/p/8984761.html