感觉python3没法写啊,没这么多类型。。。

import sys
sgs = sys.getsizeof
ll = ['short', 'int', 'long', 'long long']
for x in ll:
    print('The size of {} is {} bytes.'.format(x, sgs(int())))

坑爹啊,python3.5的编译器不保证有序。。。

table = {'short':2, 'int':4, 'long':8, 'long long':8}
for typ,size in table.items():
    print('The size of {} is {} bytes.'.format(typ, size))

#print('The size of short is 2 bytes.')
#print('The size of int is 4 bytes.')
#print('The size of long is 8 bytes.')
#print('The size of long long is 8 bytes.')