def func(self):
print('hello %s' %self.name)
def __init__(self,name,age):
self.name = name
self.age = age
Foo = type('Foo', (object,), {'talk': func,
'__init__':__init__})
f = Foo("Chrn",22)
f.talk()
print(type(Foo))
__new__.py
猜你喜欢
转载自www.cnblogs.com/mydba-j/p/11083554.html
今日推荐
周排行