python基本数据类型占用内存空间大小的实例-创新互联
python中基本数据类型和其他的语言占用的内存空间大小有很大差别
成都网站建设哪家好,找成都创新互联公司!专注于网页设计、成都网站建设、微信开发、小程序制作、集团企业网站设计等服务项目。核心团队均拥有互联网行业多年经验,服务众多知名企业客户;涵盖的客户类型包括:电动窗帘等众多领域,积累了大量丰富的经验,同时也获得了客户的一致表扬!import sys a = 100 b = True c = 100L d = 1.1 e ="" f = [] g =() h = {} i = set([]) print " %s size is %d "%(type(a),sys.getsizeof(a)) print " %s size is %d "%(type(b),sys.getsizeof(b)) print " %s size is %d "%(type(c),sys.getsizeof(c)) print " %s size is %d "%(type(d),sys.getsizeof(d)) print " %s size is %d "%(type(e),sys.getsizeof(e)) print " %s size is %d "%(type(f),sys.getsizeof(f)) print " %s size is %d "%(type(g),sys.getsizeof(g)) print " %s size is %d "%(type(h),sys.getsizeof(h)) print " %s size is %d "%(type(i),sys.getsizeof(i))size is 12 size is 12 size is 14 size is 16 size is 21 size is 36 size is 28 size is 140 size is 116
分享标题:python基本数据类型占用内存空间大小的实例-创新互联
分享链接:http://myzitong.com/article/dggggh.html