def func(self): print('hello %s' %self.name)def __init__(self,name,age): self.name = name self.age = ageFoo = type('Foo', (object,), {'talk': func, '__init__':__init__})f = Foo("Chrn",22)f.talk()print(type(Foo))
posted on 2019-06-25 16:26 小白君的成长 阅读(138) 评论(0) 编辑 收藏 举报