python查看变量的数据类型

首先需注意python并不区分short和long类型,python里面只有

在Python 3里,只有一种整数类型 int,表示为长整型。

内置的 type() 函数可以用来查询变量所指的对象类型。
>>> nfc=[“Packers”,”49″]
>>> afc=[“Ravens”,”48″]
>>> combine=zip(nfc,afc)
>>> type(combine)
<class ‘zip’>

查看变量的内存地址
#利用内置函数id(),是以十进制显示
>>> id(nfc)
2646554913160
>>> id(afc)
2646554913544
查看变量所占字节的大小
 
>>> import sys
>>> print(sys.getsizeof(combine))
64
>>> print(sys.getsizeof(nfc))
80
>>> print(sys.getsizeof(afc))
80

    原文作者:小Q小Q
    原文地址: https://blog.csdn.net/weixin_45942949/article/details/116805603
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞