To find the type of a variable or expression use the function type(), which accepts any variable or expression as input. The type is returned as a character string which can be printed or used in comparisons between variables :

# Returns the type of the following expressions

x = 9
print(x, ' is a ' , type(x))
x = 2000-01-01
print(x, ' is a ' , type(x))
x = "abc"
print(x, ' is a ' , type(x))
x = [1,"abc",2]
print(x, ' is a ' , type(x))

 

this will print:

9 is a number
2000-01-01 00:00:00 is a date
abc is a string
[1,"abc",2] is a list