x=input('Enter input:')
print (type(x))
if type(x)==type(""):
print ("It is a string")
elif type(x)==type(1):
print ("It is an integer")
elif type(x)==type(1.0):
print ("It is a floating point")
else:
print ("It is other than integer,floating point and string")
每次运行此程序时,<class 'str'>
和'It is a string'
都会作为输出。