不同整型数据类型在内存中占多大(字节),具体格式详见输出样例,输出样例中的?为不同整型数据类型在内存中占的字节数。输出样例如下: The size of short is ? bytes. The size of int is ? bytes. The size of long is ? bytes. The size of long long is ? bytes.
感觉python3没法写啊,没这么多类型。。。 import sys
sgs = sys.getsizeof
ll = ['short', 'int', 'long', 'long long']
for x in ll:
print('The size of {} is {} bytes.'
展开全文