type(x) is types.IntType # 判断是否int 类型
type(x) is types.StringType #是否string类型
用type(),就可以查他是什么类型的
>>> def test(self):... print "123"
>>> type(test)
<type 'function'>
>>> a = 123
>>> type(a)
<type 'int'>
>>> b = "123"
>>> type(b)
<type 'str'>
>>> c = 123.456
>>> type(c)
<type 'float'>
>>>
如果是函数,可以用dir(该函数名),还可以显示函数的方法使用方法