num=input("please input the num: ") print "the number your input is: "+str(num) def checktype(num): if isinstance(num,(int,long,float,complex)):##isinstance 是判断是否是一个类的实例,如果是返回true print str(num)+" type is "+type(num).__name__ else: print str(num)+" type is not sure" checktype(num)