import types if type(a)==types.IntType: print “Int type” if isinstance(data, int): … print ‘int’ … elif isinstance(data, str): … print ‘str’ python build-in functions getattr(object, name[, default]) hasattr(object, name) =========================== 捕获所有异常 try a=b b=c except Exception,ex: print Exception,’:’,ex except: all unknown exception [...]