一、代码

class_name='car'
dict_name={}
bases=(object,) class_body='''
def __init__(self,name):
self.name=name def driver(self):
print('%s汽车开走了',self.name) '''
#将类体内容放入名称空间
exec(class_body,{},dict_name)
print(dict_name)
car=type(class_name,bases,dict_name)
print(car)

最新文章

  1. Xamarin+Prism开发详解一:PCL跨平台类库与Profile的关系
  2. Linux 下如何安装软件
  3. sql server存储过程编程
  4. "稀奇古怪的"delete this
  5. VS2010运行正常的控制台程序在VS2015中出现乱码的解决方法
  6. Linux netlink机制
  7. 转载linq to sql 的详解
  8. 使用EPEL和REMI第三方yum源
  9. HTML本地存储,localstorg的应用实例
  10. 【论文:麦克风阵列增强】Speech Enhancement Based on the General Transfer Function GSC and Postfiltering
  11. SpringMVC handleMapping 处理器映射器 属性清单
  12. C语言的第 次作业总结
  13. javascript 内存管理
  14. (转)Vue种key的作用
  15. python------面向对象进阶反射详解(重点)
  16. webservice跨域问题
  17. Unity之Application.runInBackground = true
  18. springcloud使用Hystrix实现微服务的容错处理
  19. sublime sftp注册码
  20. git merge和git rebase的区别(转)

热门文章

  1. thinkphp助手函数
  2. 在 Keil uVision4 MDK下配置开发STM32F103Z完整教程
  3. Box-Cox变换
  4. Linux(二)高级文本处理
  5. Android Activity XML配置
  6. 【硬盘】RAID卡
  7. bzoj1010题解
  8. 累乘函数线性逆元打表,阶乘反演——bzoj4816
  9. 38 ubuntu/windows双系统安装
  10. jsonp的原理,应用场景,优缺点