摘要:
>>> a=10>>> b=10>>> a is bTrue>>> c=10.0>>> d=10.0>>> c is dFalse>>> a==bTrue>>> c==dTrue>>> id(c)47464176>>> id(d)47460624>>> id(a)505911152>>> id(b)... 阅读全文
posted @ 2014-04-13 21:53
tim胖
阅读(120)
评论(0)
推荐(0)
摘要:
type()和isinstance()判断类型>>> a=111>>> type(a)>>> a=111>>> isinstance(a,int)True一个明显的区别是判断子类。type()不会认为子类是一种父类类型。isinstance()会认为子类是一种父类类型。>>> class A: pass>>> class B(A): pass>>> isinstance(A(),A)True>>> type(A())==ATrue>>> 阅读全文
posted @ 2014-04-13 00:13
tim胖
阅读(173)
评论(0)
推荐(0)
浙公网安备 33010602011771号