首页 > 编程语言 > 详细

python如何打印变量的类型

时间:2015-09-29 02:03:21      阅读:157      评论:0      收藏:0      [点我收藏+]

对于基本类型使用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

python如何打印变量的类型

原文:http://luchuan.iteye.com/blog/2246637

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!