运维网's Archiver
论坛
›
Python
› python如何打印变量的类型
ab168
发表于 2017-4-28 09:44:30
python如何打印变量的类型
对于基本类型使用type函数,即
print type(a)
对于对象,使用__class__,或者直接str()
print a.__class__
print str(a)
参考:http://outofmemory.cn/code-snippet/13637/python-get-type-of-variable-or-instance
页:
[1]
查看完整版本:
python如何打印变量的类型