python数据分析基础(23)-查看变量所占字节数
2020-04-14 本文已影响0人
Zhigang_Han
import sys
a = {"a":1, "b":2}
b = "cdefgh"
c = "b"
sys.getsizeof(a)
sys.getsizeof(b)
sys.getsizeof(c)
out:
240
55
50
import sys
a = {"a":1, "b":2}
b = "cdefgh"
c = "b"
sys.getsizeof(a)
sys.getsizeof(b)
sys.getsizeof(c)
out:
240
55
50