当前位置:  首页>> 技术小册>> Python合辑13-面向对象编程案例(上)

  1. e1 = type('Employee', (), {})()
  2. print(e1)
  3. e1.name = "John Doe"
  4. print(e1.name)

Output:

  1. <__main__.Employee object at 0x0000000002DCC780>
  2. John Doe

该分类下的相关小册推荐: