python如何打印變量的類型

對於基本類型使用type函數,即python print type(a)  對於對象,使用__class__,或者直接str()函數 print a.__class__ print str(a)   參考:http://outofmemory.cn/code-snippet/13637/python-get-type-of-variable-or-instancecode
相關文章
相關標籤/搜索