标签:div name blog 1.2 内存 size oat style sys
from sys import getsizeof class A(object): pass class B: pass for x in (None, 1, 1L, 1.2, ‘c‘, [], (), {}, set(), B, B(), A, A()): print "{0:20s}\t{1:d}".format(type(x).__name__, sys.getsizeof(x)) NoneType 16 int 24 long 28 float 24 str 34 list 64 tuple 48 dict 272 set 224 classobj 96 instance 64 type 896 A 56
Python 获得对象内存占用内存大小 sys.getsizeof
标签:div name blog 1.2 内存 size oat style sys
原文地址:http://www.cnblogs.com/dadadechengzi/p/6245173.html